Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

passwordRealm fails after migration to null safety #5

Closed
nickeliot opened this issue Oct 6, 2021 · 3 comments
Closed

passwordRealm fails after migration to null safety #5

nickeliot opened this issue Oct 6, 2021 · 3 comments

Comments

@nickeliot
Copy link

We are trying to transition our application to null safe status, but are having issues with the Auth0 package.
When we execute the "passwordRealm" method, an exception is thrown.

    Auth0User passwordResponse = await auth0.passwordRealm({
      'username': username,
      'password': password,
      'realm': 'Username-Password-Authentication',
    });

type 'Null' is not a subtype of type 'String'

The message implies that a "string" value is not properly assigned, but we are failing to figure out what it is.
Any help or insight would be appreciated.

We had everything working before we migrated to null safety.

@mishatron
Copy link
Owner

Thanks, i will look at it today. Do you know at what place we have an issue?

@nickeliot
Copy link
Author

It appears that the members of Auth0User are non-nullable.
This is problematic because the Auth0 response for ...

Auth0User passwordResponse = await auth0.passwordRealm({
    'username': username,
    'password': password,
    'realm': 'Username-Password-Authentication',
});

does not return a "refreshToken".

Similarly ...

Auth0User accessResponse = await auth0.passwordRealm({
      'username': username,
      'password': password,
      'realm': 'Username-Password-Authentication',
      'audience': 'https://AcmeLabs/Api',
      'scope': 'offline_access'
    });

does not return an "idToken".

Other combinations 'audience' and 'scope' may generate issues as well. We did not test further.

Workaround

Expand 'scope' to force return of missing data.
For first case set 'scope' to 'offline_access'.

Auth0User passwordResponse = await auth0.passwordRealm({
    'username': username,
    'password': password,
    'realm': 'Username-Password-Authentication',
    'scope': 'offline_access'
});

In second case, add 'openid' to 'scope'.

Auth0User accessResponse = await auth0.passwordRealm({
      'username': username,
      'password': password,
      'realm': 'Username-Password-Authentication',
      'audience': 'https://AcmeLabs/Api',
      'scope': 'offline_access openid'
    });

@mishatron
Copy link
Owner

I released version 2.0.2 where all fileds of the Auth0User are nullable, so it should not cause any problems. I close issue for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants