From 8546db499b29b2252d3795734a200c3f09126dca Mon Sep 17 00:00:00 2001 From: Cassian Lup Date: Wed, 23 May 2018 12:33:14 +0300 Subject: [PATCH] Updating README to include Auth0 instructions on OIDC Flag; Adding 'profile' as an Auth0 scope in order to recieve the user's name on login --- App.js | 8 +++++--- README.md | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/App.js b/App.js index e37f958..27a98a4 100644 --- a/App.js +++ b/App.js @@ -20,9 +20,11 @@ import jwtDecoder from 'jwt-decode'; to see what URL to add if the above is confusing. If you use Facebook through Auth0, be sure to follow this guide: https://auth0.com/docs/connections/social/facebook + + You also need to disable the OIDC Conformant flag from Auth0's config. (_Your App_ > Settings > Show Advanced Settings > OAuth > OIDC Conformant) for this to work. */ -const auth0ClientId = '5SyUscgqrnRJ6WW3Evv5MIZZLfHOQtE9'; const auth0Domain = 'https://brentvatne.auth0.com'; +const auth0ClientId = '5SyUscgqrnRJ6WW3Evv5MIZZLfHOQtE9'; /** * Converts an object to a query string. @@ -45,7 +47,7 @@ export default class App extends React.Component { authUrl: `${auth0Domain}/authorize` + toQueryString({ client_id: auth0ClientId, response_type: 'token', - scope: 'openid name', + scope: 'openid profile name', redirect_uri: redirectUrl, }), }); @@ -115,4 +117,4 @@ const styles = StyleSheet.create({ textAlign: 'center', marginTop: 40, }, -}); \ No newline at end of file +}); diff --git a/README.md b/README.md index 411a382..c1232fc 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ Try it at https://expo.io/@community/expo-auth0 ## Setup -- Create your application client on https://auth0.com/ -- In the application settings you need to add the [AuthSession docs](https://docs.expo.io/versions/latest/sdk/auth-session.html) callback url, which looks something like this: `https://auth.expo.io/@your-username/your-app-slug`. In the app code we have `https://auth.expo.io/@community/expo-auth0` because I am signed in as `@community` and the slug for this app is `expo-auth0`. You will need to replace `community` with your Expo username. -- Find references to `https://brentvatne.auth0.com/authorize` in `App.js` and replace it with the authorization endpoint for your Auth0 account, which you can see on your Auth0 dashboard. +1. Create your application client on https://auth0.com/ +2. In the application settings you need to add the [AuthSession docs](https://docs.expo.io/versions/latest/sdk/auth-session.html) callback url, which looks something like this: `https://auth.expo.io/@your-username/your-app-slug`. +3. In the app code we have `https://auth.expo.io/@community/expo-auth0` because I am signed in as `@community` and the slug for this app is `expo-auth0`. (You will need to replace `community` with your Expo username.) + +> **Note**: You need to **disable** the **OIDC Conformant** flag from Auth0's config. (_Your App_ > Settings > Show Advanced Settings > OAuth > OIDC Conformant) for this to work. Otherwise, the first token Auth0 sends is an `access_token` instead of the `id_token` we expect.