Skip to content

Commit

Permalink
Merge pull request #316 from auth0/warn-schema
Browse files Browse the repository at this point in the history
Warn when bundle identifier contains uppercase characters
  • Loading branch information
lbalmaceda authored Jun 9, 2020
2 parents 1396162 + 831444f commit 3dbc6ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ If your application is generated using the React Native CLI, the default value o

Callback URLs are the URLs that Auth0 invokes after the authentication process. Auth0 routes your application back to this URL and appends additional parameters to it, including a token. Since callback URLs can be manipulated, you will need to add this URL to your Application's **Allowed Callback URLs** for security. This will enable Auth0 to recognize these URLs as valid. If omitted, authentication will not be successful.

> Callback URLs must have a valid scheme value as defined by the [specification](https://tools.ietf.org/html/rfc3986#page-17). Note however that platforms like Android don't follow this RFC and define the scheme and host values as case-sensitive. Since this SDK makes use of the Android's Package Name and its analogous iOS's Product Bundle Identifier to generate the redirect URL, it's advised to use lower case values for such. A "Redirect URI is not valid" error will raise if this format is not respected.
On the Android platform this URL is case-sensitive. Because of that, this SDK will auto convert the Bundle Identifier (iOS) and Application ID (Android) values to lowercase in order to build the Callback URL with them. If any of these values contains uppercase characters a warning message will be printed in the console. Make sure to check that the right Callback URL is whitelisted in the Auth0 dashboard or the browser will not route succesfully back to your application.

Go to the [Auth0 Dashboard](https://manage.auth0.com/#/applications), select your application and make sure that **Allowed Callback URLs** contains the URLs defined below.

Expand Down
10 changes: 7 additions & 3 deletions src/webauth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ const {A0Auth0} = NativeModules;

const callbackUri = domain => {
const bundleIdentifier = A0Auth0.bundleIdentifier;
return `${bundleIdentifier.toLowerCase()}://${domain}/${
Platform.OS
}/${bundleIdentifier}/callback`;
const lowerCasedIdentifier = bundleIdentifier.toLowerCase();
if (bundleIdentifier !== lowerCasedIdentifier) {
console.warn(
'The Bundle Identifier or Application ID of your app contains uppercase characters and will be lowercased to build the Callback URL. Check the Auth0 dashboard to whitelist the right URL value.',
);
}
return `${lowerCasedIdentifier}://${domain}/${Platform.OS}/${bundleIdentifier}/callback`;
};

/**
Expand Down

0 comments on commit 3dbc6ee

Please sign in to comment.