Skip to content

Latest commit

 

History

History
42 lines (28 loc) · 3.31 KB

File metadata and controls

42 lines (28 loc) · 3.31 KB

Configuring OAuth for Asset Atlas

One of the app’s features is the ability to have users create and login to their own accounts, which can be done with Google and Github accounts. Unfortunately this must be manually configured for every instance of Asset Atlas, but is not too difficult of a task.

The rough outline of this process is:

  1. Configure OAuth logins for Google and Github
  2. Create "secrets.env" in the app directory
  3. Insert needed data into "secrets.env"

1. Configuring OAuth logins for Google and Github

OAuth is a process that allows users to login to the app using external accounts, namely Github and Google in this case. In order to have these function properly, you will need to register an app with these providers, which will let them know where the user is trying to log in to.

  1. Google OAuth Registration (read fully before starting)

    1. Read the official Google documentation for the actual process of creating the cloud client
    2. When you are registering, you will be prompted for "Authorized redirect URIs". This will be what brings us back to the application once google has logged the user in, and you will need to provide this link. The actual link you give may differ, but it will take the form of **(home page)**/api/oauth/callbackGoogle. So if you are hosting the app locally at http://localhost:3000, the URI should be http://localhost:3000/api/oauth/callbackGoogle.
    3. The end result of the registration process will be a client ID and a client secret. Hold onto these and save them for later, particularly the secret, as you can only look at it once.
  2. Github OAuth Registration (read fully before starting)

    1. Read the official GitHub documentation for the process of registering an OAuth app with GitHub
    2. When you are registering, you will be prompted for "Homepage URL". This is just the link where your main page lies. For example if locally hosted at http://localhost:3000, this is where the main page would lie.
    3. You will also be prompted for an "Authorization callback URL". This will be the home page url + /api/oauth/callbackGithub, so http://localhost:3000/api/oauth/callbackGithub if following the previous example.
    4. The end result of the registration process will be a client ID and a client secret. Hold onto these and save them for later, particularly the secret, as you can only look at it once.

2. Creating secrets.env in the app folder

Now that you have the data needed, you will need to have somewhere to store it so that the app can use it.

  1. Navigate to the folder where you downloaded your app. This should be the same folder that holds docker-compose-ghcr.yml
  2. Create a new file in this folder, and name it secrets.env

3. Adding data to secrets.env

Now that we have the file, we need to add the data to it.

  1. Open secrets.env with a text editor
  2. Visit the docker/secrets.env.example on GitHub
  3. Copy the example text into your file
  4. Update all fields as needed with the data you got from registering the OAuth apps

Once this is complete, users should be able to login with OAuth.