Skip to content
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

Documentation partially wrong/incomplete for Android url scheme #273

Open
phal0r opened this issue Sep 19, 2024 · 0 comments
Open

Documentation partially wrong/incomplete for Android url scheme #273

phal0r opened this issue Sep 19, 2024 · 0 comments

Comments

@phal0r
Copy link

phal0r commented Sep 19, 2024

Description

In the setup it is described to add the android:host attribute to the intent-filter with the default custom url scheme generated by Capacitor. This was discussed as a solution for #15 .

Additionally it is advised that appAuthRedirectScheme in manifestPlaceholder of the gradle file should match the custom_url_scheme variable generated by Capacitor.

It works in most cases, but for the wrong reason and might lead to issues when using url schemes elsewhere in the app.

Here is why:

  • the openid sdk being used will add its own intent-filter to the AndroidManifest and introduces the appAuthRedirectScheme, that must be configured
  • if the android:host is not specified, both intent-filters will respond when using the configured url scheme (which would be the same for both variables)
  • specifying android:host just increases the specifity of the default intent-filter, this is why the Android Google success shows 2 duplicate apps to return to on success #15 seems to be fixed, because the plugin will callback to the app without host like so: com.example.app://?code=xyz
  • if one now uses the url-scheme for callback elsewhere with the configured host, i.e. com.example.app://oauth?more_parameters=123, Android Google success shows 2 duplicate apps to return to on success #15 will appear again, because it matches both intent-filters
  • to really solve this issue, it would be better to advise, that appAuthRedirectScheme and custom_url_scheme should be different values and android:host must not necessarily be specified, saving us users of the plugin the time to investigate the issue the other way around :)

Capacitor version:

any

Library version:

all

Affected Platform(s):

  • Android
    • Version/API Level: all
    • Device Model: all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant