auth0 / auth0-flutter

Auth0 SDK for Flutter
https://pub.dev/documentation/auth0_flutter/latest/
Apache License 2.0
59 stars 39 forks source link

Web: Missing Refresh Token #271

Closed matecode closed 1 year ago

matecode commented 1 year ago

Checklist

Description

I found a problem using refreshtokens and localstorage on web implementation. I not 100% sure if im doing it wrong or if this is a bug, because i cannot give an audience for onLoad function.

Reproduction

This is the inital conf:

      final credentials = await auth0Web.onLoad(
        cacheLocation: CacheLocation.localStorage,
        useRefreshTokens: true,
      );

and here the Login happens:

final credentials = await auth0Web.loginWithPopup(
        audience: Config.auth0Audience,
      );

The data is saved in LocalStorage as expected with audience information.

When I rerun the application i get the following WebException from onLoad():

[ERROR] | 11:26:38 466ms | Missing Refresh Token (audience: '', scope: 'openid profile email offline_access')

So there is an error that we do not have an audience here. Where can i config the audience in onLoad? Is this an misusing on my side?

Additional context

No response

auth0_flutter version

1.2.0

Flutter version

3.10.2

Platform

Web

Platform version(s)

1.2.0

stevehobbsdev commented 1 year ago

I'm looking into this now but I think this might be an oversight on our part - the underlying SDK does allow you to specify audience during initialization and we just haven't surfaced it. Let me repro it and will confirm back.

matecode commented 1 year ago

Works perfectly!

Thanks a lot for quick fix!

stevehobbsdev commented 1 year ago

@matecode Thanks for trying it out! I've just published v1.2.1 that contains the fix, so this is now live.

Thanks for the bug report!