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

Auth flow closing if you switch focus between the app and the browser #186

Open
andrewpmoore opened this issue Apr 26, 2024 · 0 comments
Open

Comments

@andrewpmoore
Copy link

I'm finding the library great for simplifying the auth flow, thanks.
I'm having one issue, I have the following code

IhOAuth2Client oauth2Client = IhOAuth2Client(
      domain: environment.getAuthDomain(), // such as 'auth.example.co.uk'
      redirectUri: platformGetRedirectUri(),
      customUriScheme: platformGetCustomUriScheme(),
    );

OAuth2Helper oauth2Helper = OAuth2Helper(oauth2Client,
        grantType: OAuth2Helper.authorizationCode,
        clientId: 'mobileClient',
        webAuthOpts: {'preferEphemeral': true},
        scopes: ["unclaimTask", "task", "calendars", "submitDataCapture", "claimTask", "noteTypes", "viewActivePatientServices", "executeRule", "tasks"]);


http.Response resp = await oAuth2Helper!.get('https://auth.example.co.uk/api/oauthuser');

When I launch the last line to get the authUser the browser pops up as expected, if I log in everything is fine.
The issue is that when the window pops up I switch back to the app without entering anything in the browser I get an error from the http.Response. That means that if you switch back to the browser to log in, it's not tied to anything and just errors.

Is there something I'm missing in what I need to do to handle this?
So far I've tried it on windows and android and both show the same behavior

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