Skip to main content
POST
/
auth
/
token
/
refresh
JS SDK
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>"
}

Response

OK

The authentication's details.

token
string
required

The JWT token used for registration or authentication.