callback - JS SDK Auth Reference
This documentation provides a reference to the sdk.auth.callback
method used to send requests to Medusa's Authentication API routes. It can be used for admin users, customers, or custom actor types.
This method is used to validate an Oauth callback from a third-party service, such as Google, for an admin user, customer, or custom actor types. It sends a request to the Validate Authentication Callback.
The method stores the returned token and passes it in the header of subsequent requests. So, you can call the store.customer.create or refresh methods, for example, after calling this method.
Learn more in the JS SDK Authentication guide.
Example#
Parameters#
actor
stringThe actor type. For example,
user
for admin user, or customer
for customer.method
stringThe authentication provider to use. For example,
google
.query
Record<string, unknown>OptionalThe query parameters from the Oauth callback, which should be passed to the API route. This includes query parameters like
code
and state
.Returns#
Promise
Promise<string>The authentication JWT token
Promise
Promise<string>Was this page helpful?