Files
authentik/website/docs/users-sources/sources/social-logins/google/index.md
Tana M Berry 6d5172d18a website: latest PR for new Docs structure (#11639)
* first pass

* dependency shenanigans

* move blueprints

* few broken links

* change config the throw errors

* internal file edits

* fighting links

* remove sidebarDev

* fix subdomain

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* fix relative URL

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* fix mismatched package versions

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* fix api reference build

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* test tweak

* links hell

* more links hell

* links hell2

* yep last of the links

* last broken link fixed

* re-add cves

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* add devdocs redirects

* add dir

* tweak netlify.toml

* move latest 2 CVES into dir

* fix links to moved cves

* typoed title fix

* fix link

* remove banner

* remove committed api docs

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>

* integrations: remove version dropdown

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>

* Update Makefile

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>

* change doc links in web as well

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>

* fix some more docs paths

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>

* fix more docs paths

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>

* ci: require ci-web.build for merging

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>

* Revert "ci: require ci-web.build for merging"

This reverts commit b99a4842a9.

* remove sluf for Application

* put slug back in

* minor fix to trigger deploy

* Spelled out Documentation in menu bar

* remove image redirects...

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* remove explicit index.md

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* remove mdx first

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* then remove .md

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* add missing prefix

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

---------

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Co-authored-by: Tana M Berry <tana@goauthentik.com>
Co-authored-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
2024-10-09 09:33:40 -05:00

4.0 KiB

title
title
Google

Support level: Community

Allows users to authenticate using their Google credentials

Preparation

The following placeholders will be used:

  • authentik.company is the FQDN of the authentik install.

Google

You will need to create a new project, and OAuth credentials in the Google Developer console. The developer console can be overwhelming at first.

  1. Visit https://console.developers.google.com/ to create a new project
  2. Create a New project.

  1. Project Name: Choose a name
  2. Organization: Leave as default if unsure
  3. Location: Leave as default if unsure

  1. Click Create
  2. Choose your project from the drop down at the top
  3. Click the Credentials menu item on the left. It looks like a key.

  1. Click on Configure Consent Screen

  1. User Type: If you do not have a Google Workspace (GSuite) account choose External. If you do have a Google Workspace (Gsuite) account and want to limit access to only users inside of your organization choose Internal

I'm only going to list the mandatory/important fields to complete.

  1. App Name: Choose an Application
  2. User Support Email: Must have a value
  3. Authorized Domains: authentik.company
  4. Developer Contact Info: Must have a value
  5. Click Save and Continue
  6. If you have special scopes configured for google, enter them on this screen. If not click Save and Continue
  7. If you want to create Test Users enter them here, if not click Save and Continue
  8. From the Summary Page click on the *Credentials link on the left. Same link as step 8
  9. Click Create Credentials on the top of the screen
  10. Choose OAuth Client ID

  1. Application Type: Web Application
  2. Name: Choose a name
  3. Authorized redirect URIs: https://authentik.company/source/oauth/callback/google/

  1. Click Create
  2. Copy and store Your Client ID and Your Client Secret for later

authentik

  1. Under Directory -> Federation & Social login Click Create Google OAuth Source

  2. Name: Choose a name (For the example I use Google)

  3. Slug: google (If you choose a different slug the URLs will need to be updated to reflect the change)

  4. Consumer Key: Your Client ID from step 25

  5. Consumer Secret: Your Client Secret from step 25

Here is an example of a complete authentik Google OAuth Source

Save, and you now have Google as a source.

:::note For more details on how-to have the new source display on the Login Page see here. :::

Username mapping

Since google does not have the concept of a username, authentik will by default prompt the user for a username when they first enroll through a google source. To change this behaviour and automatically use the email address as username, create an expression policy to set the username to the email, and bind it to the enrollment flow.

Create an expression policy with this expression:

email = request.context["prompt_data"]["email"]
# Direct set username to email
request.context["prompt_data"]["username"] = email
# Set username to email without domain
# request.context["prompt_data"]["username"] = email.split("@")[0]
return False

Afterwards, edit the source's enrollment flow (by default default-source-enrollment), expand the policies bound to the first stage (default-source-enrollment-prompt), and bind the policy created above. Make sure the newly created policy comes before default-source-enrollment-if-username. Afterwards, any new logins will automatically have their google email address used as their username.

This can be combined with disallowing users from changing their usernames, see Configuration.