Session Token
Returns the seller's current session JWT from the YouCan Seller Area. This token is used to exchange for a store access token on your server.
In most cases you don't need to call this directly — qantra.initialize() handles token injection automatically. Use this when you need the raw token for a specific request.
Signature
ts
qantra.sessionToken(): Promise<string>Example
ts
import { sessionToken } from '@youcan/qantra';
const token = await sessionToken();
// Use it as a Bearer token to call your own server
const res = await fetch('/api/store', {
headers: { Authorization: `Bearer ${token}` },
});How it works
sessionToken() sends a postMessage to the parent Seller Area window, which calls its own internal API to generate a signed JWT and returns it to your app. The returned token can then be exchanged for a long-lived store access token via POST /oauth/token.
See Authentication for the full exchange flow.