appsup-dart / openid_client

Library for working with OpenID Connect and implementing clients.
BSD 3-Clause "New" or "Revised" License
90 stars 118 forks source link

[Question] Best practice for web - Is there a way to "await" the credentials? #93

Closed danielRi closed 1 year ago

danielRi commented 1 year ago

Hi,

Disclaimer: not a bug report, just request support

in the web example, because window.location.href is used to navigated to auth server prompt, the whole flutter application basically is stopping, then when the auth server redirects to the flutter app again, I have to somehow call await authenticator.credentials again to see get the data.

I would love to have something like

final credentials = await authenticator.authorize();
// continue execution here once Im signed in

I know its probably a bit of a dumb question, but does somebody know if this is possible, maybe with using url_launcher?

Thanks so much for any help! Daniel

rbellens commented 1 year ago

No, that is not possible unless you open the auth screen in a separate tab/popup/screen/frame, so that you never leave your app. But that will require communication between the pages, which would be more complex to implement.