Skip to content

Strange Google OAuth2 authorization error/bug #135

@alexbjorlig

Description

@alexbjorlig

My app is initialized like this: admin.initializeApp(functions.config().firebase);

I have a firebase function, where I try to check if a user exists using auth.getUserByEmail().
I serve this function through express, withexports.app = functions.https.onRequest(app).

I get this error from firebase-functions:

Error: Credential implementation provided to initializeApp() via the "credential" property failed to fetch a valid Google OAuth2access token with the following error: 
"Error fetching access token: invalid_grant (Token has been expired or revoked.)". 
There are two likely causes: 
(1) your server time is not properly synced or 
(2) your certificate key file has been revoked. 
To solve (1), re-sync the time on your server. 
To solve (2), make sure the key ID for your key file is still present at https://console.firebase.google.com/iam-admin/serviceaccounts/project. 
If not, generate a newkey file at https://console.firebase.google.com/project/_/settings/serviceaccounts/adminsdk.

I really hope you can help me out on this one. The solutions in the above does not help me.

UPDATE:

If I deploy functions --> it works in production.
I created a test-http function, this one works.

Version info

firebase-functions: 0.7.3

firebase-tools: 3.15.3

firebase-admin: 5.4.2

node: v.8.9.1

Steps to reproduce

Create a firebase http function that uses the auth.

Expected behavior

That the functions work.

Actual behavior

I get the above error

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions