-
Notifications
You must be signed in to change notification settings - Fork 209
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
[Question] Redirect from browser after web auth doesn't happen #130
Comments
cc @lbalmaceda, @cocojoe |
Now I use patch-package to revert changes of #126. |
Which browser app is causing this, and which android version? |
Android 7.1.2, both Firefox and Chrome have the same behavior. |
In my view, the current behavior is expected. The browser activity which is launched in the current task fires a redirect, this redirect is captured by the intent filter of my application. But the application is already on top of the stack with a browser activity in the foreground. So I have to navigate back to the activity of my application by pressing Back button. What were the reasons of PR #126, which made the browser activity to run in the task of the app? |
Besides, FLAG_ACTIVITY_NO_HISTORY is apparently required. |
@egorshulga Hi, I suggest you look at the original issue #124 to look at the change in behaviour. However, this change alone does not introduce the issue you are reporting. I have tested this in API25 with Chrome and @lbalmaceda has tested with Chrome and Firefox with no issues. I feel this is most likely a configuration issue as we are unable to reproduce your issue using our standard sample project. |
Ok, I also had to replace Unfortunately for me, I cannot reproduce the issue so I have to recheck my entire configuration. |
Well, I'm stuck. |
@egorshulga Sure, it would probably be a good to take 5 mins, create a clean project and work through the Quickstart, in particular the Android steps. Also check against the README It is often something small like the launch mode or an activity. |
I am also facing the same issue just like @egorshulga posted earlier, but In Android, it's working & in iOS, the issue is coming. Just showing an indicator. @cocojoe |
I'm having the same problem on Android. Working on iOS. Downgrading to version 1.2.1 resolves the issue. "react": "16.3.1", compileSdkVersion 27 android:launchMode="singleTask" |
@stefanedberg Probably related to |
Same problem on android, iOS works fine. |
Changing android:host to my custom auth0 domain fixed the issue. I would advise anyone who doesn't have a custom domain to at least double check that their host is correct. |
@JanErikFoss can you provide an example of what changing the host looks like? not sure exactly what/where to update? |
In your AndroidManifest.xml you should have something that looks like this. <!-- react-native-auth0 webAuth -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="login.bikefinder.com"
android:pathPrefix="/android/${applicationId}/callback"
android:scheme="${applicationId}" />
</intent-filter> |
Changes introduced in the PR #126 are OK. And Android 9 is now enforcing the use of that flag when starting activities from a context other than an Activity (the one used for the Custom Tabs scenario). This is not an issue of the SDK. I'll proceed to close this one, but don't hesitate in opening a new one if you run into other kind of issues with this SDK. Regarding the use of custom domains as @JanErikFoss correctly pointed out you need to update the host. That behavior is explained on the feature page where the use of SDKs is mentioned. The way the authentication works on native clients is that after you've logged-in in the browser, you get redirected to the app. For that to succeed the redirect uri sent on the web authentication must match whatever you have registered in the intent-filter of your android application. If there's a subtle different, things won't work. (You'll get stuck on the browser app).
If any of these 3 steps above declare a different domain, the redirection will fail. There's only one that would remain using the "auth0 domain" instead of the "custom domain", and that is the |
Setting |
Hello egorshulga, I'am the same problem. did you solve it? thank! |
@cenergon Hey, I've seen this behaviour caused when the So let's say you have the following intent filter
When However the uri it'll actually be trying to redirect back to once you've authenticated will be It's mentioned here to use lowercase for the scheme: https://developer.android.com/guide/topics/manifest/data-element It's a slightly tricky one to track down because Auth0 doesn't seem to validate the scheme part for casing although it does validate the pathPrefix part. |
We mention the use of lowercase for Android apps in the readme. But.. there's always room for improvement, what will be better @leemcmullen ? |
@lbalmaceda Thanks for the heads up on that Luciano, I'd missed that part of the readme to be honest! My 2 suggestions to improve things slightly would be: a) try to emphasise the point in the readme a little more i.e. that if there are uppercase characters in the package name on Android then it will fail to take you back to the app because of the conversion to lowercase behind the scenes when generating the redirect_uri. b) try to improve the dev experience a little when there are uppercase characters present on Android. One suggestion might be to throw an error if there are uppercase characters in the scheme portion of the redirect_uri on Android (it seems to work fine on iOS) so at least the developer knows where to start looking. At the moment the auth browser just hangs with a spinner on the Sign In button, no obvious error gets logged and so it's difficult to know where to start troubleshooting. It's probably a bit of an edge case but I've been stung by it in the past so chances are someone else might have been too! 😃 |
@leemcmullen It's a shame android behaves differently than other platforms on scheme capitalization... I like your suggestion of throwing an error when it contains uppercase chars. And will definitely give the readme a review. Thanks! We're tracking this internally. |
@leemcmullen I've opened a PR to try to improve this. Let me know what you think about it. |
Version: 1.2.2
Steps to reproduce:
auth.webAuth.authorize()
.Browser with a hosted login page opens.
Expected behavior:
The browser redirects execution back to the application.
Actual behavior:
Redirect doesn't happen.
I have to press back button to return to the application.
logcat output:
This behavior was introduced by PR #126.
Downgrading to the version 1.2.1 resolves the issue.
The text was updated successfully, but these errors were encountered: