Could anyone provide a working sample of a Swagger security definition for firebase authentication?
On the backend, firebase ID token is verified using the firebase admin SDK:
import * as admin from 'firebase-admin';
await admin.auth().verifyIdToken(idToken);
What should be the values in the Swagger security definition to get the proper ID token for firebase?
"securityDefinitions": {
"firebase": {
"authorizationUrl": "https://accounts.google.com/o/oauth2/v2/auth",
"flow": "implicit",
"type": "oauth2",
"x-google-issuer": "https://securetoken.google.com/MY-PROJECT-ID",
"x-google-jwks_uri": "https://www.googleapis.com/service_accounts/v1/metadata/x509/securetoken@system.gserviceaccount.com",
"x-google-audiences": "MY-CLIENT-ID",
"scopes": {
"https://www.googleapis.com/auth/firebase": "Firebase scope"
}
}
}
I do get a token back, however, firebase admin SDK says it's not valid:
Decoding Firebase ID token failed. Make sure you passed the entire string JWT which represents an ID token
Not sure if this is because of the wrong scopes or token types...