How to handle browser sign in Flutter Desktop?

445 Views Asked by At

I have a web app that uses an oAuth2 login. I'm planning to develop a Flutter Desktop App. I can handle the auth in the Flutter App but if the user has already logged in to the web, it's easier to just handle auth in the browser and redirect to the app.

An example of this use case is Figma. They do the auth in the browser and redirect to the app after.

1

There are 1 best solutions below

2
Yonkee On

What you are talking about here is single sign on. In order for this to work you will need to manage the users login state somewhere that both clients can check. From an OAuth perspective you could use a third party and then use something like Aotuh Authorisation code flow from the client with a prompt-none to attempt to retrieve an auth code if a current session is still valid. Have a read through some of these links to determine your options -

Auth0 - https://auth0.com/docs/authenticate/login/configure-silent-authentication#:~:text=The%20OpenID%20Connect%20protocol%20supports,%2C%20consent%2C%20or%20MFA%20).

RFC - https://www.rfc-editor.org/rfc/rfc6749