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:
- Configure OAuth logins for Google and Github
- Create "secrets.env" in the app directory
- Insert needed data into "secrets.env"
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.
-
Google OAuth Registration (read fully before starting)
- Read the official Google documentation for the actual process of creating the cloud client
- 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 behttp://localhost:3000/api/oauth/callbackGoogle. - 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.
-
Github OAuth Registration (read fully before starting)
- Read the official GitHub documentation for the process of registering an OAuth app with GitHub
- 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. - You will also be prompted for an "Authorization callback URL". This will be the home page url +
/api/oauth/callbackGithub, sohttp://localhost:3000/api/oauth/callbackGithubif following the previous example. - 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.
Now that you have the data needed, you will need to have somewhere to store it so that the app can use it.
- Navigate to the folder where you downloaded your app. This should be the same folder that holds
docker-compose-ghcr.yml - Create a new file in this folder, and name it
secrets.env
Now that we have the file, we need to add the data to it.
- Open
secrets.envwith a text editor - Visit the docker/secrets.env.example on GitHub
- Copy the example text into your file
- 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.