Configure authentication with GitHub
Amplication client and server rely on GitHub OAuth mechanism to secure user interactions.
In order to configure GitHub auth and sync integration when running client and server locally, you can follow the steps below.
GitHub OAuth for user authentication
Amplication leverage GitHub OAuth implementation that supports the standard authorization code grant type.
Step 1: Create a new GitHub OAuth App
- Login in your GitHub account and create a new GitHub OAuth application here
- Enter the fields as follows:
- Application name -
[your-github-username]-amplication-local
. - Homepage URL -
http://localhost:3001
If you are hosting the Amplication client on any other address, use the specific address. - Application description - optional
- Authorization callback URL -
http://localhost:3000
. If you are hosting the Amplication server on any other address, use the specific address.
- Application name -
- Click
Register application
.
- Click
Generate a new client secret
and copy the resulting secret
Step 2: Configure Amplication server and client to work with the new GitHub app
- Clone /packages/amplication-server/.env into
/packages/amplication-server/.env.local
- Update
/packages/amplication-server/.env.local
with the following variablesGITHUB_REDIRECT_URI=http://localhost:3000/github/callback
GITHUB_CLIENT_ID="replace with the github auth application client id"
GITHUB_CLIENT_SECRET="replace with secret created as step 4""
GITHUB_SCOPE="user:email" - Clone /packages/amplication-client/.env into
/packages/amplication-client/.env.local
- Update
/packages/amplication-client/.env.local
with the following variablesNX_REACT_APP_GITHUB_AUTH_ENABLED=true
NX_REACT_APP_GITHUB_CONTROLLER_LOGIN_URL=http://localhost:3000/github - Restart Amplication server and client.