OAuth2 with Flutter Web
Mar 8, 2021
Sometimes it can be very difficult to handle OAuth with Flutter (Web).
I have done it the following way but can’t find any official documentation about this:
Add the route to the main MaterialApp:
Next create the AuthService:
Next create a filled called callback.html in your web folder:
Now you got OAuth2 working on Flutter Web and Flutter Mobile. If you wanna got an Authorization Header value to call your backend you can use this._authService.getAccessTokenIfLoggedIn.