New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flutter Web Login #1
Comments
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? |
I am getting this link https://sfasfsafas.supabase.co/auth/v1/verify?token=sfasfsafas&type=magiclink&redirect_to=http://localhost:5555/#/callback? But this link get opened it doesn't go given callback URL http://localhost:5555/#access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.safsafsafsa.safsafasfasfas-ZhaRkptXQF9hi4paapSBQ4iJvg&expires_in=3600&refresh_token=afsafsafsacxascas&token_type=bearer&type=magiclink |
Hi @nomanmurtaza786, if you want to use a custom redirect_to for flutter web. Please replace
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. |
+1 for flutter mobile Apps. |
Right now |
@phamhieu i think it's more like flutter web guide rather than supabase. Open popup and go back when uri.base contain access token. |
sorry, i misunderstand your question. Can you share more why you want to do it in a popup instead of a full page redirect? |
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. |
yes exactly instead, full screen can we do it in the popup and go back to the same page. |
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! |
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. |
@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. |
@himeshp Pop kind of thing is already happening in the phone. With webview here is code. I don't know how flutter web popup work because thing package don't support web. Expanded(
child: InAppWebView(
initialUrlRequest: URLRequest(url: Uri.parse("https://12345supaaaaedfdsfds.supabase.co/auth/v1/authorize?provider=google")),
initialOptions: InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
supportZoom: true,
userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0"
),
),
onWebViewCreated: (InAppWebViewController controller) {
webView = controller;
},
onLoadStart: (controller, url) {
if(isFirstTime){
isFirstTime = false;
Future.delayed(Duration(milliseconds: 2000))
.then((onValue) {
setState(() {
_isLoading = false;
});
});
}
print(url);
print(controller.getUrl());
print('load start');
if(url.toString().contains('access_token')){
Navigator.pop(context, url.toString());
}
},
onLoadStop: (controller, url) async {
print(url);
print(controller.getUrl());
print('load stop');
//}
}, |
I don't think so native pop-up is supported yet for mobile apps. also as shared by @dshukertjr you might have to wait until it's supported by the backend. |
So there seems to be two discussions about pop ups going on here:
In my previous post on this issue, I was talking about 2, because users are already logged into Google, Twitter, or whatever account they are using to sign in, which leads to better user experience as @himeshp described:
@nomanmurtaza786 you seem to want 1, but what is the reason why you prefer pop up over full page redirect? Also, this pop idea using webview is cleaver, but the users would still have to sign on to their twitter or whatever provider they are trying to sign in with as it is not a native pop-up sign on. Also, Google does not seem to let you sign in from within a webview.
|
I want to send the user back to the same screen, I think I can pass the current page URL as a redirection parameter to do that. @phamhieu If we added one domain in the supabase setting can redirect to any sub-page of that domain? |
@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: 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? |
@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. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
To redirect in a popup, we could use url_launcher's cc @dshukertjr |
Closing this issue as the original issue where provider sign in fails when using Flutter web with |
* Add updated url-configuration screenshot (#1) * Add updated url-configuration screenshot * Update README.md * Update README.md Co-authored-by: Vinzent <vinzentwitte@gmail.com> * refactor: move image file --------- Co-authored-by: Vinzent <vinzentwitte@gmail.com> Co-authored-by: Vinzent <vinzent03@proton.me>
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 #?
The text was updated successfully, but these errors were encountered: