GitHub OAuth application
We use GitHub OAuth application for authentication. You need to configure one for your Local (only if you run API locally) or GCP Dev environments. This document describes how to do that.
Create new GitHub OAuth application
- Go to your profile's settings
- Developer settings -> OAuth Apps -> New OAuth app
- Application name: some name just for GitHub
- Homepage URL:
WebApp_URL/app
- Authorization callback URL:
WebApp_URL/api/auth/login/provider/github/callback
- Click "Register application"
- Client ID will be visible on the page (e.g.
895088f0046818e7eefb
) - save it - Click "Generate a new client secret" and save Client Secret (e.g.
09137e821fafdc2580adaf9779b88b937a756d0f
). Make sure to copy your new client secret now. You won’t be able to see it again. If you lose it, just generate a new one.
Example for Local env:
Homepage URL: http://localhost:3000/app
Authorization callback URL: http://localhost:3000/api/auth/login/provider/github/callback
Example for GCP Dev env:
Homepage URL: https://arapi-tenst7-3rnrw36ioq-ew.a.run.app/app
Authorization callback URL: https://arapi-tenst7-3rnrw36ioq-ew.a.run.app/api/auth/login/provider/github/callback
Configure Local environment
Export environment variables for API (use your values):
export AR_AUTH_GITHUB_CLIENT_ID=895088f0046818e7eefb
export AR_AUTH_GITHUB_CLIENT_SECRET=09137e821fafdc2580adaf9779b88b937a756d0f
Configure GCP environment
- Go to the Secret Manager
- Find your secrets:
arapi-WORKSPACE-auth_github_client_id
andarapi-WORKSPACE-auth_github_client_secret
- Update each key with proper values
- Click on the secret
- Click "+ New Version"
- Provide new secret value
- Check "Disable all past versions"
- Click "Add New Version"
- Go to Cloud Run
- Find your API:
arapi-WORKSPACE
- Deploy new Revision (even with the same image), this will trigger getting new secret values