-
Notifications
You must be signed in to change notification settings - Fork 582
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
Graphql throwing invalid session #3983
Comments
Realm GraphQL only works with legacy Realm Cloud (pre v10). You will have to migrate to MongoDB Realm Cloud which supports GraphQL. |
@kneth |
And It was working till now with anonymous login. But as I mentioned above now I'm using custom JWT it starts showing me this error message |
Please take a look and https://docs.mongodb.com/realm/graphql/ and https://docs.mongodb.com/realm/mongodb/link-a-data-source/ |
How frequently does the bug occur?
Sometimes
Description
I’m using realm-graphql in my electron app. Now I’m facing an error while I’m passing authentication token in the header of graphql request.
This is the error:
Error: Network error: invalid session: failed to find refresh token at new ApolloError.
Here's my code:
async function getValidAccessToken () { const app = await getRealmApp() // Guarantee that there's a logged in user with a valid access token if (!app.currentUser) { // If no user is logged in, log in an anonymous user. The logged in user will have a valid // access token. const token = 'xyz....' if (token) { const credentials = Realm.Credentials.jwt(token); await app.logIn(credentials); } } else { // An already logged in user's access token might be stale. To guarantee that the token is // valid, we refresh the user's custom data which also refreshes their access token. await app.currentUser.refreshCustomData() } return app.currentUser.accessToken }
Stacktrace & log output
No response
Can you reproduce the bug?
Yes, sometimes
Reproduction Steps
No response
Version
10.4.0
What SDK flavour are you using?
MongoDB Realm (i.e. Sync, auth, functions)
Are you using encryption?
No, not using encryption
Platform OS and version(s)
Macos big sur Version: 11.5.2
Build environment
Which debugger for React Native: ..
The text was updated successfully, but these errors were encountered: