JWT metadata missing on User object
See original GitHub issueGoals
I have specified metadata fields in the custom JWT authentication settings, but these fields do not appear on the user object after logging in.
I am working with realm-web
version 0.9.0
Expected Results
When using the Stitch SDK these fields could be found on the user.profile.data
object (mongodb-stitch-browser-sdk
version 4.8.0
).
Actual Results
The user.profile.data
object does not exist. See screenshots.
Steps to Reproduce
Use custom JWT authentication with metadata fields. Login in the browser and check the logged in user object.
Code Sample
const loggedInUser = await realmApp.logIn(Realm.Credentials.jwt(jwtString))
console.log(loggedInUser.profile.data) // undefined
Version of Realm and Tooling
- Realm JS SDK Version: realm-web 0.9.0
- Node or React Native: Web
- Client OS & Version: Chrome 85 on macOS 10.15.7
- Which debugger for React Native: None
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Rule to add user_metadata attributes to user object in ...
Hi John,. Yeah the idToken or the user object through useAuth0 through the auth0-react package.
Read more >Custom JWT Authentication provider metadata - MongoDB
I have managed to connect to Mongo Realm. I created a user but I was not able to see the user-created in Realm....
Read more >JSON Web Token Introduction - jwt.io
Learn about JSON Web Tokens, what are they, how they work, when and why you should use them.
Read more >JWT: The Complete Guide to JSON Web Tokens
A Step-by-Step Guide for learning JSON Web Tokens, including signatures, single page web application User Authentication and Session ...
Read more >JWT authentication: Best practices and when to use it
However, this is not ideal for users, who may have their tokens expired for no reason. One way to do it is to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@andrew-whitmore short answer is no. #3481 fixed this for Realm Web (since that was the SDK the original poster was using), but we still have outstanding issues adding this across our other SDKs. I’ll ensure these issues are tracked and get back here with a link so you can follow the progress.
@kraenhansen - should this work now?
I have version 10.2.0 of realm using a custom JWT authentication provider and custom profile data is not working as expected. As a work around we are currently using the birthday field on profile to pass a value down that we need. See screen shot
then after login If I inspect the profile like so
then the opu field is not present.
Thanks
Andy