import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
const token = await sdk.auth.refresh()
// all subsequent requests will use the token in the header
const { user } = await sdk.admin.user.me(){
"token": "<string>"
}Refresh the authentication token of a user. This is useful after authenticating a user with a third-party service to ensure the token holds the new user’s details, or when you don’t want users to re-login every day.
import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
const token = await sdk.auth.refresh()
// all subsequent requests will use the token in the header
const { user } = await sdk.admin.user.me(){
"token": "<string>"
}OK
The authentication's details.
The JWT token used for registration or authentication.