import{_ as e,c as i,o as t,a4 as o}from"./chunks/framework.BmdFiWrL.js";const f=JSON.parse('{"title":"Cloudflare Access OAuth2 Configuration","description":"","frontmatter":{"outline":"deep"},"headers":[],"relativePath":"en_US/guide/q8.md","filePath":"en_US/guide/q8.md","lastUpdated":1724530785000}'),a={name:"en_US/guide/q8.md"},c=o(`
If you encounter issues logging in as an administrator using Github, Gitlab, or Gitee, you may consider switching to Cloudflare Access as the OAuth2 provider.
Oauth2:
Admin: 701b9ea6-9f56-48cd-af3e-cbb4bfc1475c
ClientID: 3516291f53eca9b4901a01337e41be7dc52f565c8657d08a3fddb2178d13c5bf
ClientSecret: 0568b67c7b6d0ed51c663e2fe935683007c28f947a27b7bd47a5ad3d8b56fb67
Endpoint: "https://xxxxx.cloudflareaccess.com"
Type: cloudflare
Parameter | Retrieval Method |
---|---|
Admin | My Team -> Users -> <specific user> -> User ID |
ClientID/ClientSecret | Access -> Application -> Add an Application -> SaaS -> OIDC |
Endpoint | Access -> Application -> Application URL -> Only keep the protocol and domain, no path |
Navigate to the Zero Trust Dashboard: https://one.dash.cloudflare.com/. Choose or create a new account, then follow these steps:
My Team
-> Users
-> Click <specific user>
-> Obtain and save the User ID
. (If this is your first time using Zero Trust, the Users list will be empty, and you can skip this step; users will appear after completing a verification.)Access
-> Applications
-> Add an Application
.SaaS
. In the Application
field, enter a custom application name (e.g., nezha
), select OIDC
, and then click Add application
.Scopes
, select openid
, email
, profile
, groups
.Redirect URLs
, enter your Dashboard Callback URL, such as https://dashboard.example.com/oauth2/callback
.Client ID
, Client Secret
, and the protocol and domain part of the Issuer
address, for example, https://xxxxx.cloudflareaccess.com
./opt/nezha/dashboard/data/config.yaml
), adjust the OAuth2
settings according to the example configuration, and restart the Dashboard service.After setting up the Dashboard, you need to configure identity verification policies in the Zero Trust Dashboard. Navigate to: Access
-> Applications
-> <application name>
-> Policies
. You can choose from various SSO authentication methods, including email OTP and hardware key verification. For detailed configurations, refer to the Cloudflare Zero Trust Documentation.
Using email OTP as the default verification method:
Access
-> Applications
-> <application name>
-> Policies
-> Add a policy
.Policy Name
, for example, OTP
, and set Action
to Allow
.Configure rules
, add a new Include
rule. Select Emails
as the Selector
and enter your email address in the textbox.Save policy
to save the configuration.Send me a code
, and then enter the code received to log in to the Dashboard.User ID
was not specified in Admin
during previous steps, an error message will be displayed after login: "This user is not an administrator of this site and cannot log in." At this point, you need to go to My Team
-> Users
, find the corresponding user, click on the username to get the User ID
, and enter it into the Admin
section of the Dashboard configuration file. After restarting the Dashboard service, try logging in again.