This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
generated from creasico/laravel-package
-
Notifications
You must be signed in to change notification settings - Fork 0
feat(auth): Initialize authentication API #85
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Fery Wardiyanto <[email protected]>
Signed-off-by: Fery Wardiyanto <[email protected]>
Signed-off-by: Fery Wardiyanto <[email protected]>
Signed-off-by: Fery Wardiyanto <[email protected]>
Signed-off-by: Fery Wardiyanto <[email protected]>
…f it Signed-off-by: Fery Wardiyanto <[email protected]>
Signed-off-by: Fery Wardiyanto <[email protected]>
…ult configs Signed-off-by: Fery Wardiyanto <[email protected]>
Signed-off-by: Fery Wardiyanto <[email protected]>
… `sanctum.expiration` is null Signed-off-by: Fery Wardiyanto <[email protected]>
instead of hard-coded the model name, it's prevent error when user actually customize the model via `Sanctum::usePersonalAccessTokenModel()` method Signed-off-by: Fery Wardiyanto <[email protected]>
Signed-off-by: Fery Wardiyanto <[email protected]>
…ry string only for `GET` and `HEAD` request method, otherwise we'll keep using Bearer headers Signed-off-by: Fery Wardiyanto <[email protected]>
… authenticated Previously the `base.login` end-point only supports `username` field which is represent the `name` field in `users` table. In some circumstances we might needs to be authenticated via `email` field instead. This way we could configure the way our project is authenticating it' users via `creasi.base.credentials` config key. The option supports array of strings that represents the field on `users` table that we want to use as user' credential Signed-off-by: Fery Wardiyanto <[email protected]>
Signed-off-by: Fery Wardiyanto <[email protected]>
Signed-off-by: Fery Wardiyanto <[email protected]>
creasi
approved these changes
Feb 11, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementasi saat ini memang masih belum bisa meng-cover semua case yang umumnya kita butuhkan, tapi setidaknya sudah cukup untuk dijadikan pondasi feature apa saja yang perlu kita sediakan berikutnya.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
api
db: schema
docs
Improvements or additions to documentation
enhancement
New feature or request
localization
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Essentially this PR is an extraction of what's already implemented in our
skeleton
with the exception of UI.GET
HEAD
/auth
base.verify
DELETE
/auth
base.logout
POST
/auth/login
base.login
POST
/auth/refresh
base.refresh
refresh
tokenPOST
/auth/register
base.register
POST
/auth/forgot-password
base.password.forgot
GET
HEAD
/auth/reset-password/{token}
base.password.reset
PUT
/auth/reset-password
base.password.update
POST
/auth/email/verification-send
base.verification.send
GET
HEAD
/auth/email/verify/{id}/{hash}
base.verification.verify
base.verify
End-point:
GET {APP_URL}/auth
Headers:
Authorization
Bearer {ACCESS_TOKEN}
Accept
application/json
Response:
Success
Status:
200 Ok
Invalid Access Token
Status:
401 Unauthorized
base.logout
End-point:
DELETE {APP_URL}/auth
Headers:
Authorization
Bearer {ACCESS_TOKEN}
Accept
application/json
Response:
Success Status:
204 No Content
Invalid Access Token
Status:
401 Unauthorized
base.login
End-point:
POST {APP_URL}/auth/login
Headers:
Accept
application/json
Content-Type
application/json
Body:
credential
string
required
password
string
required
remember
boolean
optional
device_token
string
optional
Response:
Success
Status:
201 Created
Invalid Inputs
Status:
422 Unprocessable Content
base.refresh
End-point:
POST {APP_URL}/auth/refresh
Headers:
Authorization
Bearer {REFRESH_TOKEN}
Accept
application/json
Response:
Success
Status:
201 Created
Invalid Access Token
Status:
401 Unauthorized
base.register
End-point:
POST {APP_URL}/auth/register
Headers:
Accept
application/json
Content-Type
application/json
Body:
name
string
min:2
max:150
required
email
string
unique
email
required
password
string
min:8
required
password_confirmation
string
equals:password
required
Response:
Success
Status:
201 Created
Invalid Inputs
Status:
422 Unprocessable Content
base.password.forgot
End-point:
POST {APP_URL}/auth/forgot-password
Headers:
Accept
application/json
Content-Type
application/json
Body:
email
string
exists
email
required
Response:
Success
Status:
200 Ok
Invalid Inputs
Status:
422 Unprocessable Content
base.password.reset
End-point:
GET {APP_URL}/auth/reset-password/{token}
Route Params:
token
string
required
Response:
base.password.update
End-point:
PUT {APP_URL}/auth/reset-password
Headers:
Accept
application/json
Content-Type
application/json
Body:
token
string
required
base.password.reset
routeemail
string
exists
email
required
password
string
required
password_confirmation
string
required
Response:
Success
Status:
200 Ok
base.verification.send
End-point:
POST {APP_URL}/auth/email/verification-send
Headers:
Authorization
Bearer {ACCESS_TOKEN}
Accept
application/json
Response:
Success
Status:
200 Ok
Invalid Access Token
Status:
401 Unauthorized
base.verification.verify
End-point:
GET {APP_URL}/auth/email/verify/{id}/{hash}
Route Params:
id
string
required
hash
string
required
Response: