This guide explains how to configure single sign-on (SSO) support for NetBox using Google OAuth2 as an authentication backend.
http[s]://<netbox>[:<port>]http[s]://<netbox>[:<port>]/oauth/complete/google-oauth2/!!! note
Google requires the NetBox hostname to use a public top-level-domain (e.g. `.com`, `.net`). The use of IP addresses is not permitted (except `127.0.0.1`).
For more information, consult Google's documentation.
Enter the following configuration parameters in configuration.py, substituting your own values:
REMOTE_AUTH_BACKEND = 'social_core.backends.google.GoogleOAuth2'
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '{CLIENT_ID}'
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = '{CLIENT_SECRET}'
Restart the NetBox services so that the new configuration takes effect. This is typically done with the command below:
sudo systemctl restart netbox
Log out of NetBox if already authenticated, and click the "Log In" button at top right. You should see the normal login form as well as an option to authenticate using Google. Click that link.
You should be redirected to Google's authentication portal. Enter the username/email and password of your test account to continue. You may also be prompted to grant this application access to your account.
If successful, you will be redirected back to the NetBox UI, and will be logged in as the Google user. You can verify this by navigating to your profile (using the button at top right).
This user account has been replicated locally to NetBox, and can now be assigned groups and permissions.