Skip to main content

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

Auth flow

Amplication leverage GitHub OAuth implementation that supports the standard authorization code grant type.

Step 1: Create a new GitHub OAuth App

  1. Login in your GitHub account and create a new GitHub OAuth application here

  1. 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.
  2. Click Register application.

  1. 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

  1. Clone /packages/amplication-server/.env into /packages/amplication-server/.env.local
  2. Update /packages/amplication-server/.env.local with the following variables
    GITHUB_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"
  3. Clone /packages/amplication-client/.env into /packages/amplication-client/.env.local
  4. Update /packages/amplication-client/.env.local with the following variables
    NX_REACT_APP_GITHUB_AUTH_ENABLED=true
    NX_REACT_APP_GITHUB_CONTROLLER_LOGIN_URL=http://localhost:3000/github
  5. Restart Amplication server and client.