Skip to content

[Question]: How to pass JWT token parameter when Identity Verification is enabled? #1839

@aman123shi

Description

@aman123shi

How can we help?

Version 5.2.13 of the React Native SDK, the login() method only accepts an external_id. It doesn’t take a JWT token directly, even when Identity Verification is enabled.

So I don't see any method to pass the JWT token, so can somebody help me to achieve this

I have asked the support team and got this response

"
Version 5.2.13 of the React Native SDK, the login() method only accepts an external_id. It doesn’t take a JWT token directly, even when Identity Verification is enabled.

Instead, JWT handling happens automatically through a JWT provider. You’ll need to register one before calling login(). Here’s a quick example:

OneSignal.User.setJwtProvider(async () => { const jwt = await fetchJwtFromServer(); // your backend returns a valid JWT return jwt; }); OneSignal.login(externalId);
This setup makes sure the SDK securely retrieves and uses the JWT behind the scenes.

Passing the token directly like OneSignal.login({ external_id, jwt }) isn’t supported at this time.

"

But I couldn't find 'OneSignal.User.setJwtProvider' method on the User class

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions