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

[fresh_graphql] wrong auth status #82

Open
subzero911 opened this issue Mar 31, 2023 · 1 comment
Open

[fresh_graphql] wrong auth status #82

subzero911 opened this issue Mar 31, 2023 · 1 comment

Comments

@subzero911
Copy link

subzero911 commented Mar 31, 2023

At the first time I do setToken(), status always turns to "unauthorized".
After refresh it becomes authorized.

code:

final freshLink = FreshLink.oAuth2(
    tokenStorage: InMemoryTokenStorage(),
    refreshToken: (token, client) async {
      // Perform refresh and return new token
      log.d('refreshing token!');
      return OAuth2Token(accessToken: accessToken, tokenType: 'Bearer'); // TODO refresh with RefreshToken
    },
    shouldRefresh: (response) => true, // TODO implement
  )..authenticationStatus.listen(log.d);
  await freshLink.setToken(OAuth2Token(accessToken: accessToken, tokenType: 'Bearer'));

I debugged it and cannot find an issue, but the problem is definitely in setToken().
I await it and suddenly execution goes to void _updateStatus where token is null !

@subzero911
Copy link
Author

subzero911 commented Mar 31, 2023

That's extremely strange, but if I subscribe to status AFTER setToken(), it works just fine:

image

Result:

image

Maybe the problem's because of this line
image
When I create a FreshLink, the setter runned, and it suddenly turns status to "unauthenticated". Just guessing...

@subzero911 subzero911 changed the title [fresh_graphql] numerous bugs [fresh_graphql] wrong auth status Apr 1, 2023
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

1 participant