Skip to content

Expo plugin support for Android App Links #1282

@CodingItWrong

Description

@CodingItWrong

Checklist

  • I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Describe the problem you'd like to have solved

When I switched my Expo app from using custom scheme callback URLs to HTTPS callback URLs, I was not able to use the official react-native-auth0 Expo config plugin to configure the manifestPlaceholders needed to get the domain recognized. I had to write and use a small custom Expo config plugin instead.

Describe the ideal solution

I would like the official react-native-auth0 Expo config plugin to support configuring manifestPlaceholders to allow using Android App Links for HTTPS post-sign-in redirects.

This would make it easier for other users of the library to use Android App Links, which are more secure.

Alternatives and current workarounds

I was able to write the following custom Expo config plugin in our project to populate the manifestPlaceholders:

const { withAppBuildGradle } = require("expo/config-plugins")

const withAuth0 = (config, options = {}) => {
  config = withCustomAppBuildGradle(config, options)
  return config
}

const withCustomAppBuildGradle = (config, options) => {
  return withAppBuildGradle(config, (config) => {
    config.modResults.contents = config.modResults.contents.replace(
      `minSdkVersion rootProject.ext.minSdkVersion`,
      `manifestPlaceholders = [auth0Domain: "${options.domain}", auth0Scheme: "https"]
          minSdkVersion rootProject.ext.minSdkVersion`,
    )

    return config
  })
}

module.exports = withAuth0

app.json:

["./plugins/withAuth0.js", { domain: "your.tenant.auth0.com" }]

Additional context

I had thought that using the config plugin like so would populate the manifestPlaceholders:

["react-native-auth0", { customScheme: "https", domain: "your.tenant.auth0.com" }]

Unfortunately, I did not see the manifestPlaceholders in the generated Android project, but I do see them when I run my custom plugin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestA feature has been asked for or suggested by the community

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions