docs: document dependencies for auth provider (#10865)
* docs: document dependencies for auth provider * fixes * document overriding callback url
This commit is contained in:
@@ -32,9 +32,9 @@ The steps are:
|
||||
2. Use the authentication token to create the user with their respective API route.
|
||||
- For example, for customers you would use the [Create Customer API route](!api!/store#customers_postcustomers).
|
||||
- For admin users, you accept an invite using the [Accept Invite API route](!api!/admin#invites_postinvitesaccept)
|
||||
3. Authenticate the user with the [Auth Route](#auth-route).
|
||||
3. Authenticate the user with the [Auth Route](#login-route).
|
||||
|
||||
After registration, you only use the [Auth Route](#auth-route) for subsequent authentication.
|
||||
After registration, you only use the [Auth Route](#login-route) for subsequent authentication.
|
||||
|
||||
<Note>
|
||||
|
||||
@@ -56,7 +56,7 @@ It requires the following steps:
|
||||
|
||||

|
||||
|
||||
1. Authenticate the user with the [Auth Route](#auth-route).
|
||||
1. Authenticate the user with the [Auth Route](#login-route).
|
||||
2. The auth route returns a URL to authenticate with third-party service, such as login with Google. The frontend (such as a storefront), when it receives a `location` property in the response, must redirect to the returned location.
|
||||
3. Once the authentication with the third-party service finishes, it redirects back to the frontend with a `code` query parameter. So, make sure your third-party service is configured to redirect to your frontend page after successful authentication.
|
||||
4. The frontend sends a request to the [Callback Route](#callback-route) passing the `code` query parameter.
|
||||
@@ -87,7 +87,7 @@ curl -X POST http://localhost:9000/auth/{actor_type}/{providers}/register
|
||||
|
||||
<Note>
|
||||
|
||||
This API route is useful for providers like `emailpass` that uses custom logic to authenticate a user. For authentication providers that authenticate with third-party services, such as Google, use the [Auth Route](#auth-route) instead.
|
||||
This API route is useful for providers like `emailpass` that uses custom logic to authenticate a user. For authentication providers that authenticate with third-party services, such as Google, use the [Auth Route](#login-route) instead.
|
||||
|
||||
</Note>
|
||||
|
||||
@@ -180,6 +180,12 @@ This route accepts in the request body the data that the specified authenticatio
|
||||
|
||||
For example, the EmailPass provider requires an `email` and `password` fields in the request body.
|
||||
|
||||
#### Overriding Callback URL
|
||||
|
||||
For the [GitHub](../auth-providers/github/page.mdx) and [Google](../auth-providers/google/page.mdx) providers, you can pass a `callback_url` body parameter that overrides the `callbackUrl` set in the provider's configurations.
|
||||
|
||||
This is useful if you want to redirect the user to a different URL after authentication based on their actor type. For example, you can set different `callback_url` for admin users and customers.
|
||||
|
||||
### Response Fields
|
||||
|
||||
If the authentication is successful, you'll receive a `token` field in the response body object:
|
||||
|
||||
Reference in New Issue
Block a user