Skip to content

Flutter Web Login  #1

Closed
Closed

Description

@nomanmurtaza786

Hi there,
I am trying to integrate Supabase with the flutter App. I am using plugin url_strategy to remove # from the flutter URL.
https://pub.dev/packages/url_strategy/

But when I get Supabase call back it starts with # so the flutter web router also removes that URL. Is there any we can get call back URL without #?

Activity

  1. added
    documentation
    on Jul 9, 2021
  2. phamhieu commented on Jul 9, 2021

    @phamhieu
    Member

    Hi @nomanmurtaza786, using fragment # is a gotrue design choice. You can read more details here

  3. nomanmurtaza786 commented on Jul 9, 2021

    @nomanmurtaza786
    Author

    Hi @nomanmurtaza786, using fragment # is a gotrue design choice. You can read more details here

    Actually, I am using flutter web, any guide to get a callback URL in flutter web?

  4. phamhieu commented on Jul 14, 2021

    @phamhieu
    Member

    Hi @nomanmurtaza786, if you want to use a custom redirect_to for flutter web. Please replace # with the encoded value %23

    http://localhost:55510/%23/webAuth
    

    Screenshot 2021-07-14 at 10 54 57 AM

    I suggest you to use default Site URL for flutter web. Check out the update example here

    web-demo.mp4
  5. nomanmurtaza786 commented on Jul 14, 2021

    @nomanmurtaza786
    Author

    Hi @nomanmurtaza786, if you want to use a custom redirect_to for flutter web. Please replace # with the encoded value %23

    http://localhost:55510/%23/webAuth
    
    Screenshot 2021-07-14 at 10 54 57 AM

    I suggest you to use default Site URL for flutter web. Check out the update example here

    web-demo.mp4

    Thanks, @phamhieu I will try this. but do you know how can we do the auth with popup and return back to the same screen with flutter web.

  6. himeshp commented on Jul 14, 2021

    @himeshp

    +1 for flutter mobile Apps.
    pop up + return back,

  7. phamhieu commented on Jul 14, 2021

    @phamhieu
    Member

    Right now supabase-flutter doesn't support popup

  8. nomanmurtaza786 commented on Jul 14, 2021

    @nomanmurtaza786
    Author

    Right now supabase-flutter doesn't support popup

    @phamhieu i think it's more like flutter web guide rather than supabase. Open popup and go back when uri.base contain access token.

  9. phamhieu commented on Jul 14, 2021

    @phamhieu
    Member

    because of security, i don't think we can do that on flutter web or event original web app.

    sorry, i misunderstand your question. Can you share more why you want to do it in a popup instead of a full page redirect?

  10. himeshp commented on Jul 14, 2021

    @himeshp

    It's a better user experience at least on the flutter mobile app, it takes out all the deep linking hassle + user is already logged in e.g. Twitter, Google, FB, etc.

  11. nomanmurtaza786 commented on Jul 14, 2021

    @nomanmurtaza786
    Author

    because of security, i don't think we can do that on flutter web or event original web app.

    sorry, i misunderstand your question. Can you share more why you want to do it in a popup instead of a full-page redirect?

    yes exactly instead, full screen can we do it in the popup and go back to the same page.

  12. dshukertjr commented on Jul 14, 2021

    @dshukertjr
    Member

    Supporting pop up kind of like how Firebase Auth does it involves some additional development on the server side, so at the moment it cannot be supported, but it is definitely something we would want at some point.

    @phamhieu Could we talk to the back end team about supporting this on gotrue? Not a must have, but would be great to have it somewhere along the line!

  13. himeshp commented on Jul 14, 2021

    @himeshp

    flutter web is still evolving, the adoption is slow, but on the other hand, it would be great to see pop-up support for flutter android & iOS apps.

  14. nomanmurtaza786 commented on Jul 14, 2021

    @nomanmurtaza786
    Author

    Supporting pop up kind of like how Firebase Auth does it involves some additional development on the server side, so at the moment it cannot be supported, but it is definitely something we would want at some point.

    @phamhieu Could we talk to the back end team about supporting this on gotrue? Not a must have, but would be great to have it somewhere along the line!

    @dshukertjr I think it's nothing to do with supabase it's more like a flutter web feature like I am using web view in the phone. When my url contains access token I do navigator pop and pass url back to retrieve the session. When to do same on the Web may be with dialog box it's possible.

  15. 5 remaining items

  16. nomanmurtaza786 commented on Jul 14, 2021

    @nomanmurtaza786
    Author

    @nomanmurtaza786 Ah, got it! If there is only one page that you would like to return to, they you can actually configure the redirect URL to go to that page like this:
    Screen Shot 2021-07-15 at 7 55 34

    With this, you can always make sure that the user is sent back to the login page that they originally came from! Would this be sufficient in your case?

    Thanks @dshukertjr yes. Can I do like that mydomain/post?id=12, mydomain/post?id=67 and so on. Or every /post?id should be there in the listing?

  17. phamhieu commented on Jul 14, 2021

    @phamhieu
    Member

    @nomanmurtaza786 it's better to save the current post id right before calling authentication request. Then when user comes back to the app, you can read the saved post id and show its view.

  18. spideythewebhead commented on Jul 17, 2021

    @spideythewebhead
  19. dshukertjr commented on Jul 18, 2021

    @dshukertjr
  20. spideythewebhead commented on Jul 18, 2021

    @spideythewebhead
  21. spideythewebhead commented on Jul 18, 2021

    @spideythewebhead
  22. added
    auth
    on Apr 17, 2022
  23. bdlukaa commented on Jul 17, 2022

    @bdlukaa
    Collaborator

    To redirect in a popup, we could use url_launcher's webOnlyWindowName. If we set it to _blank, a new tab would be opened. Altough opening a new tab could be an workaround, we could use this to open an actual popup, or maybe file an issue requesting this feature on url_launcher.

    cc @dshukertjr

  24. dshukertjr commented on Sep 30, 2022

    @dshukertjr
    Member

    Closing this issue as the original issue where provider sign in fails when using Flutter web with url_strategy package seems to be fixed. Please feel free to reopen this if you still encounter this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    authdocumentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions