This repo goes along with the Medium blog post Authenticating an AWS AppSync GraphQL API with Auth0.
- An Auth0 API configured with RS256 signing algorithm for both general & OAuth signing.
- AWS AppSync API configured with your Auth0 app domain.
- Clone the repo
git clone https://github.com/dabit3/appsync-auth0.git
- Change into the new directory
cd appsync-auth0
- Install dependencies
npm i
# or
yarn
-
Update the AppSync graphqlEndpoint in AppSync.js with your AppSync endpoint.
-
In App.js, configure the call to Auth0 with your credentials:
this.auth0 = new auth0.WebAuth({
domain: '<YOURAPPDOMAIN>.auth0.com',
clientID: '<YOURCLIENTID>',
redirectUri: 'http://localhost:3000/callback',
audience: 'https://<YOURAPPDOMAIN>.auth0.com/userinfo',
responseType: 'token id_token',
scope: 'openid'
});
- Run the app
npm start