oauth2_client
oauth2_client copied to clipboard
Auth flow closing if you switch focus between the app and the browser
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