Backend token endpoint
The app gets client tokens from an endpoint on your backend. That endpoint is the same for every January SDK; build it as described in Your token endpoint.
What matters for React Native:
Response. Return January's
201body unchanged. The React Native SDK reads onlyexpiresIn(seconds), not January'sexpires_in, so the token provider on the Authentication page maps the field. A token that expires within 60 seconds is rejected.Scopes. The app's
JanuaryClientuses one token for every call, so mint it with the scopes of every feature the app uses. See the scope table.Switch. Minting fails with
403 forbiddenuntil Enable client tokens is on in the Developer Dashboard.
Keep the API key off the device
Your API key (sk-…) stays on your backend. Never ship it in a build you distribute, whether in:
JavaScript or TypeScript source, or anything Metro bundles;
an
EXPO_PUBLIC_variable or a.envfile (Expo copiesEXPO_PUBLIC_values into the bundle);native source,
Info.plist,BuildConfig, or Gradle properties;remote configuration delivered to the app.
developmentApiKey is for debug builds on your own machine only; see Development API key.
Next: Authentication.
Last updated
Was this helpful?