My plugin has the following settings in “ai-plugin.json” .
"auth": {
"type": "oauth",
"client_url": "https://accounts.google.com/o/oauth2/v2/auth",
"scope": "email",
I can login by My Google account, and my plugin had received the Authorization header like:
"authorization": "Bearer ya29.{RANDOM_CHARACTERS}"
I tried to get the uid with the following code but get “FirebaseAuthError: Decoding Firebase ID token failed. Make sure you passed the entire string JWT which represents an ID token.”
import * as admin from "firebase-admin";
import * as functions from "firebase-functions";
...
async function(req: Request, res: Response) {
try {
let token = "";
if (req.headers.authorization) {
token = req.headers.authorization.split(" ")[1];
const decodedToken = await admin.auth().verifyIdToken(token);
functions.logger.info(decodedToken.uid);
}
} catch (err) {
functions.logger.error(err);
}
{RANDOM_CHARACTERS}
has 207 chars, is this just part of the ID token?
Or is there a mistake in my code?