Auth0 Home Blog Docs

Cannot read property 'methods' of undefined

Hi

I’ve started to receive this error:
Cannot read property 'methods' of undefined
when using the Auth0 C# AuthenticationAPI.

It occurs when I try to exchange a refresh token for a new access token.

I can’t find any documentation regarding what this error means, anyone got some suggestions?

That message is a typical Javascript error message so first thing to check would be if you have custom rules enabled in your tenant. Given rules execute as part of a refresh token exchange a problem in rules could be leading to such an error.

Ah yes, thank you.
Was with the “Require MFA once per session” rule.

When trying to the a refresh token instead some properties in there where missing.

const completedMfa = !!context.authentication.methods.find(
    (method) => method.name === 'mfa'
  );

was the part causing the issue.

Added this snippet at the top:

if(context.protocol === 'oauth2-refresh-token')
    return callback(null, user, context);
1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.