Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API call flow when switching between anonymous and signed in users #532

Open
dazlious opened this issue Feb 19, 2024 Discussed in #531 · 0 comments
Open

API call flow when switching between anonymous and signed in users #532

dazlious opened this issue Feb 19, 2024 Discussed in #531 · 0 comments

Comments

@dazlious
Copy link

Discussed in #531

Support just asked us to open a ticket out of that discussion for visibility. We would love to get an answer on this, as the docs are not providing clear guidelines. Best would be to actually get an example of login/logout process with two API tokens (one with JWT and one without)

Originally posted by apfelfabrik February 15, 2024
Hey everyone,

We're allowing users to open our app and sign in optionally at a later point in time. What seems to work well is the push notification device registration for anonymous users using a JWT-less API token when we initialize the SDK. Now it seems we're running into some race conditions when the user signs up/in. We need to unregister the anonymous user's device from push notifications, we need to initialize the SDK again with the JWT-based API token, and we need to register the device again for the now authenticated user.

What would be the correct or recommended order of react native SDK API calls to achieve this, including calls to initialize with the individual API keys?

Please excuse if this is a well-documented case, I couldn't find anything on this in the docs even though I think this should be rather common practice considering user management in mobile apps.

Cheers,
Martin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant