Hello,
I’m using MongoDB and Firebase Realtime Databases. For Authentication, I use MongoDB Realm. To set up security rules for Realtime Database I need to sign in also to the Google Authentication service which needs a JWT from MongoDB.
I figured out that I can get it using user.getAccessToken() function, but returned value doesn’t contain everything google needs and uses another algorithm. MongoDB uses HS256, but Google requires RS256. Google also requires “aud” and “uid” claims, which don’t exist in this token. How can I generate a custom token which meets Google’s requirements?
Thank you so much for your answers