-
Notifications
You must be signed in to change notification settings - Fork 143
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
Use Chrome Custom Tabs when possible #95
Conversation
README.md
Outdated
Also register the intent filters inside your activity's tag, so you can receive the call in your activity. Note that you will have to specify the callback url inside the `data` tag. | ||
It's a good practice to define reusable resources like `@string/auth0_domain` but you can also hard code the value. In case you're using a [custom scheme](#a-note-about-app-deep-linking) you must update the `auth0Scheme` property. | ||
|
||
Alternatively you can define your own **intent-filter** for the `RedirectActivity` in the `AndroidManifest.xml` file replacing the one defined by the library. If you choose to do this, the `manifestPlaceholders` don't need to be set. In your manifest inside your application's tag add the `RedirectActivity` declaration: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively you can declare the RedirectActivity
in the AndroidManifest.xml
file with your own intent-filter so it overrides the library's default.
If we promote https and is the best UX we can make it the default in the library, remove the placeholder and let the user declare the whole activity if he needs custom schemes. |
Another thing with the usage of placeholders: If the user doesn't want to use |
public boolean bindServiceAndLaunchUri(@NonNull Uri uri) { | ||
nextUri = uri; | ||
boolean boundRequestSuccess = bindService(); | ||
if (isBound || !boundRequestSuccess) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the negation is wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean
"launch uri if service was already bound or was just bounded successfully"
but then.. why call bindService if it was already bound?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
anybody cares if it was already bound or was bound in this call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I get it.
but from the way it's used, this can never be "already bound" because a new controller is created each time. maybe something to optimize in the activity that uses this in https://github.com/auth0/Auth0.Android/pull/95/files#diff-101f8235cd64f6d21cfc3fc82d610bd5R105
if (context != null) { | ||
context.unbindService(this); | ||
} | ||
nextUri = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be also cleared when the uri is launched?
I decided to go with the default |
fdc27aa
to
c4a9e67
Compare
…sing a placeholder.
c4a9e67
to
9ad1e0d
Compare
This PR adds support for Chrome Custom Tabs to use with the
WebAuthProvider
class when not launching a WebView. The user API remains the same, but now they need a different configuration and they can skip the call toWebAuthProvider.resume(intent)
as it's handled internally by the library. This also means that they don't need to capture theonNewIntent
oronActivityResult
method calls.Proposed configuration changes
AndroidManifest.xml
file.2a. Add both
manifestPlaceholders
to theapp/build.gradle
file so that the library knows which domain and scheme to use. The host is set automatically using theapplicationId
placeholder:2b. Alternatively, don't set the
manifestPlaceholders
but replace theRedirectActivity
definition in theAndroidManifest.xml
file with one that defines the custom Intent-Filter.Discussion
The trade-off is between setting a default
https
scheme in the library's Intent-Filter (so the user doesn't need to set an extra manifest placeholder) or setting a placeholder that the user must always define.If a normal user will use more
https
over a custom scheme, we can let them override the whole Intent-Filter in the manifest like in (2b). If a normal user will prefer custom schemes, then we can keep the 2 manifest placeholders proposal.