Auth0 Home Blog Docs

Failed Google-oauth authentication

failed-login
oauth2

#1

I have been using Google-oauth2 all this while without any problems. When I try to log in now, I am getting a failed login error. The error message I see in the logs is uninformative and says: Cannot read property ‘then’ of undefined

How can I fix this, Auth0?


#2

I have the same error on a custom db connector. Started to happen 10 minutes ago for apparently no reason.

Did someone push a faulty revision ?


#3

We have the same issue… seems to be even broader. No auth.signin gets accepted.


#4

So it doesn’t seem to be connector specific as we’re using their provided user DB.
Perhaps the error is related to one of the Rules (which we haven’t changed recently)


#5

You are absolutely right. I turned off all the rules and I am able to log in successfully. But if any one rule is on, I will get the login error.


#6

same. this is comming from auth0-authorization-extension for me. disabling the rule helps


#7

same. this is comming from auth0-authorization-extension for me. disabling the rule helps


#8

We are seeing this issue, caused by a call to

auth0.users.updateAppMetadata(user.user_id, user.app_metadata)

In a rule added by the Auth0 Authorization extension


#9

Same error here:

{ error: "access_denied" errorDescription: "Cannot read property 'then' of undefined" state: "state string" } 

It looks like disabling custom rules fixes the issue. But it’s weird it started happening all of the sudden.


#10

Is anyone able to raise this as a support ticket?
We’re on the free tier but I assume that’s why everyone else is posting here too.


#11

It seems to be the function call to auth0.users.updateAppMetadata as @kristian mentioned. We’re using the Auth-authz extension.

In our case it seemed to work to change the persistUserData function of the rule to the below, essentially skipping the auth0.users.updateAppMetadata bit and calling the cb function directly.

    // Store authorization data in the user profile so we can query it later.
    var persistUserData = function(user, groups, roles, permissions, cb) {
      user.app_metadata = user.app_metadata || {};
      user.app_metadata.authorization = {
        groups: groups,
        roles: roles,
        permissions: permissions
      };
      // auth0.users.updateAppMetadata(user.user_id, user.app_metadata)
      // .then(function() {
      //   cb();
      // })
      // .catch(function(err){
      //   cb(err);
      // });
      cb();
    };

Logins still work and the Auth groups seem to get assigned correctly. Would be great to know from Auth0 if this function call is now unnecessary?


#12

We’re having the same issue with Facebook and Google auth


#13

That workaround works for me too.
Thanks! Hopefully Auth0 rollback whatever they did soon.


#14

Workaround works for me too.


#15

SAME ERROR HERE

Cannot read property then of undefined.

username-password connection works fine, but google-oauth2 is failing.

This is pretty urgent - it has taken our production site down


#16

Hi,
This was caused by a problematic change in our Rules engine. The issue was already identified and solved.

Apologies for the inconveniences.


#17

This will only append the metadata to the user object being returned after a successful login, but won’t update the user metadata stored in Auth0. If you call the API afterwards to read the user profile, the metadata won’t be there.


#18

I am running into the same issue.


#19

I am running into the same issue.


#20

Same error here:

{ error: "access_denied" errorDescription: "Cannot read property 'then' of undefined" state: "state string" } 

It looks like disabling custom rules fixes the issue. But it’s weird it started happening all of the sudden.