0

We have a Flutter app with Google login feature. In order it to work, we need to send the access grant code to the backend service. In SPA workflow, that could easily be done by setting redirect_uri. But in mobile, we cannot do that as it is the app itself (not a website) that user needs to return. Is there any way that we can set a redirect_uri that will redirect user to app itself? (from in-app web view) Of course, I should also be able to grab the grant code from the query parameters.

Also an example would be great if it is possible to create such a redirect_uri.

suayip uzulmez
  • 628
  • 8
  • 23

1 Answers1

0

A workaround is to point the redirect_uri to a standard webpage hosted by you, and that webpage uses javascript to open the app.

How to open app from webpage: Lots of ways, such as How to open flutter application from url?

Of course, I should also be able to grab the grant code from the query parameters.

You can find plenty of tutorials about how to do that, since in the approach above, redirect_uri points to a very normal webpage.

ch271828n
  • 15,854
  • 5
  • 53
  • 88
  • Can you elaborate on how to grab query parameters In the app i.e., when I redirect user to app from my custom web page (via deep link or other), can I send some parameters to app itself, if so, how? An example would be great. – suayip uzulmez Nov 10 '21 at 08:28
  • @suayipuzulmez Yes. Simplest example is the official one: https://flutter.dev/docs/development/ui/navigation/deep-linking. When opening `http://flutterbooksample.com/book/1` it opens your app with custom page and data, etc. But for more complex, search `flutter deep link` for lots of package and tutorial – ch271828n Nov 10 '21 at 09:47