register - JS SDK Auth Reference
This documentation provides a reference to the sdk.auth.register
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 retrieve a registration JWT token for a user, customer, or custom actor type. It sends a request to the Retrieve Registration Token API route.
Then, it stores the returned token and passes it in the header of subsequent requests. So, you can call the store.customer.create method, 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,
emailpass
or google
.payload
AdminSignUpWithEmailPasswordThe data to pass in the request's body for authentication. When using the emailpass
provider,
you pass the email and password.
payload
AdminSignUpWithEmailPasswordemailpass
provider,
you pass the email and password.Returns#
Promise
Promise<string>The JWT token used for registration later.
Promise
Promise<string>Was this page helpful?