<titledata-rh="true">OAuth Provider Configuration | OAuth2 Proxy</title><metadata-rh="true"name="viewport"content="width=device-width,initial-scale=1"><metadata-rh="true"name="twitter:card"content="summary_large_image"><metadata-rh="true"property="og:url"content="https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/oauth_provider"><metadata-rh="true"name="docusaurus_locale"content="en"><metadata-rh="true"name="docsearch:language"content="en"><metadata-rh="true"name="docusaurus_version"content="7.5.x"><metadata-rh="true"name="docusaurus_tag"content="docs-default-7.5.x"><metadata-rh="true"name="docsearch:version"content="7.5.x"><metadata-rh="true"name="docsearch:docusaurus_tag"content="docs-default-7.5.x"><metadata-rh="true"property="og:title"content="OAuth Provider Configuration | OAuth2 Proxy"><metadata-rh="true"name="description"content="You will need to register an OAuth application with a Provider (Google, GitHub or another provider), and configure it with Redirect URI(s) for the domain you intend to run oauth2-proxy on."><metadata-rh="true"property="og:description"content="You will need to register an OAuth application with a Provider (Google, GitHub or another provider), and configure it with Redirect URI(s) for the domain you intend to run oauth2-proxy on."><linkdata-rh="true"rel="icon"href="/oauth2-proxy/img/logos/OAuth2_Proxy_icon.svg"><linkdata-rh="true"rel="canonical"href="https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/oauth_provider"><linkdata-rh="true"rel="alternate"href="https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/oauth_provider"hreflang="en"><linkdata-rh="true"rel="alternate"href="https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/oauth_provider"hreflang="x-default"><linkrel="stylesheet"href="/oauth2-proxy/assets/css/styles.4014daec.css">
file if you're not using <ahref="#using-application-default-credentials-adc--workload-identity--workload-identity-federation-recommended">Application Default Credentials / Workload Identity / Workload Identity Federation (recommended)</a>.</li><li>Make note of the Client ID for a future step.</li><li>Under "APIs & Auth", choose APIs.</li><li>Click on Admin SDK and then Enable API.</li><li>Follow the steps on <ahref="https://developers.google.com/admin-sdk/directory/v1/guides/delegation#delegate_domain-wide_authority_to_your_service_account"target="_blank"rel="noopener noreferrer">https://developers.google.com/admin-sdk/directory/v1/guides/delegation#delegate_domain-wide_authority_to_your_service_account</a> and give the client id from step 2 the following oauth scopes:</li></ol><h5class="anchor anchorWithStickyNavbar_LWe7"id="using-application-default-credentials-adc--workload-identity--workload-identity-federation-recommended">Using Application Default Credentials (ADC) / Workload Identity / Workload Identity Federation (recommended)<ahref="#using-application-default-credentials-adc--workload-identity--workload-identity-federation-recommended"class="hash-link"aria-label="Direct link to Using Application Default Credentials (ADC) / Workload Identity / Workload Identity Federation (recommended)"title="Direct link to Using Application Default Credentials (ADC) / Workload Identity / Workload Identity Federation (recommended)"></a></h5><p>oauth2-proxy can make use of <ahref="https://cloud.google.com/docs/authentication/application-default-credentials"target="_blank"rel="noopener noreferrer">Application Default Credentials</a>.
When deployed within GCP, this means that it can automatically use the service account attached to the resource. When deployed to GKE, ADC
can be leveraged through a feature called Workload Identity. Follow Google's <ahref="https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity"target="_blank"rel="noopener noreferrer">guide</a>
to set up Workload Identity.</p><p>When deployed outside of GCP, <ahref="https://cloud.google.com/docs/authentication/provide-credentials-adc#wlif"target="_blank"rel="noopener noreferrer">Workload Identity Federation</a> might be an option.</p><divclass="codeBlockContainer_Ckt0 theme-code-block"style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><divclass="codeBlockContent_biex"><pretabindex="0"class="prism-code language-text codeBlock_bY9V thin-scrollbar"><codeclass="codeBlockLines_e6Vv"><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">https://www.googleapis.com/auth/admin.directory.group.readonly</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">https://www.googleapis.com/auth/admin.directory.user.readonly</span><br></span></code></pre><divclass="buttonGroup__atx"><buttontype="button"aria-label="Copy code to clipboard"title="Copy"class="clean-btn"><spanclass="copyButtonIcons_eSgA"aria-hidden="true"><svgviewBox="0 0 24 24"class="copyButtonIcon_y97N"><pathfill="currentColor"d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svgviewBox="0 0 24 24"class="copyButtonSuccessIcon_LjdS"><pathfill="currentColor"d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><olstart="6"><li>Follow the steps on <ahref="https://support.google.com/a/answer/60757"target="_blank"rel="noopener noreferrer">https://support.google.com/a/answer/60757</a> to enable Admin API access.</li><li>Create or choose an existing administrative email address on the Gmail domain to assign to the <code>google-admin-email</code> flag. This email will be impersonated by this client to make calls to the Admin SDK. See the note on the link from step 5 for the reason why.</li><li>Create or choose an existing email group and set that email to the <code>google-group</code> flag. You can pass multiple instances of this flag with different groups
and the user will be checked against all the provided groups.</li><li>Lock down the permissions on the json file downloaded from step 1 so only oauth2-proxy is able to read the file and set the path to the file in the <code>google-service-account-json</code> flag.</li><li>Restart oauth2-proxy.</li></ol><p>Note: The user is checked against the group members list on initial authentication and every time the token is refreshed ( about once an hour ).</p><h3class="anchor anchorWithStickyNavbar_LWe7"id="azure-auth-provider">Azure Auth Provider<ahref="#azure-auth-provider"class="hash-link"aria-label="Direct link to Azure Auth Provider"title="Direct link to Azure Auth Provider"></a></h3><ol><li>Add an application: go to <ahref="https://portal.azure.com"target="_blank"rel="noopener noreferrer">https://portal.azure.com</a>, choose <strong>Azure Active Directory</strong>, select
<strong>App registrations</strong> and then click on <strong>New registration</strong>.</li><li>Pick a name, check the supported account type(single-tenant, multi-tenant, etc). In the <strong>Redirect URI</strong> section create a new
<strong>Web</strong> platform entry for each app that you want to protect by the oauth2 proxy(e.g.
<ahref="https://internal.yourcompanycom/oauth2/callback"target="_blank"rel="noopener noreferrer">https://internal.yourcompanycom/oauth2/callback</a>). Click <strong>Register</strong>.</li><li>Next we need to add group read permissions for the app registration, on the <strong>API Permissions</strong> page of the app, click on
<strong>Add a permission</strong>, select <strong>Microsoft Graph</strong>, then select <strong>Application permissions</strong>, then click on <strong>Group</strong> and select
<strong>Group.Read.All</strong>. Hit <strong>Add permissions</strong> and then on <strong>Grant admin consent</strong> (you might need an admin to do this).<br>**IMPORTANT**: Even if this permission is listed with **"Admin consent required=No"** the consent might actually be required, due to AAD policies you won't be able to see. If you get a **"Need admin approval"** during login, most likely this is what you're missing!</li><li>Next, if you are planning to use v2.0 Azure Auth endpoint, go to the <strong>Manifest</strong> page and set <code>"accessTokenAcceptedVersion": 2</code>
with <code>--resource</code> flag, be sure to append <code>/.default</code> at the end of the resource name. See
<ahref="https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent#the-default-scope"target="_blank"rel="noopener noreferrer">https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent#the-default-scope</a> for more details.</li><li>When using the Azure Auth provider with nginx and the cookie session store you may find the cookie is too large and doesn't
get passed through correctly. Increasing the proxy_buffer_size in nginx or implementing the <ahref="/oauth2-proxy/docs/configuration/session_storage#redis-storage">redis session storage</a>
should resolve this.</li></ul><h3class="anchor anchorWithStickyNavbar_LWe7"id="adfs-auth-provider">ADFS Auth Provider<ahref="#adfs-auth-provider"class="hash-link"aria-label="Direct link to ADFS Auth Provider"title="Direct link to ADFS Auth Provider"></a></h3><ol><li>Open the ADFS administration console on your Windows Server and add a new Application Group</li><li>Provide a name for the integration, select Server Application from the Standalone applications section and click Next</li><li>Follow the wizard to get the client-id, client-secret and configure the application credentials</li><li>Configure the proxy with</li></ol><divclass="codeBlockContainer_Ckt0 theme-code-block"style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><divclass="codeBlockContent_biex"><pretabindex="0"class="prism-code language-text codeBlock_bY9V thin-scrollbar"><codeclass="codeBlockLines_e6Vv"><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> --provider=adfs</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> --client-id=<application ID from step 3></span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> --client-secret=<value from step 3></span><br></span></code></pre><divclass="buttonGroup__atx"><buttontype="button"aria-label="Copy code to clipboard"title="Copy"class="clean-btn"><spanclass="copyButtonIcons_eSgA"aria-hidden="true"><svgviewBox="0 0 24 24"class="copyButtonIcon_y97N"><pathfill="currentColor"d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svgviewBox="0 0 24 24"class="copyButtonSuccessIcon_LjdS"><pathfill="currentColor"d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Note: When using the ADFS Auth provider with nginx and the cookie session store you may find the cookie is too large and doesn't get passed through correctly. Increasing the proxy_buffer_size in nginx or implementing the <ahref="/oauth2-proxy/docs/configuration/session_storage#redis-storage">redis session storage</a> should resolve this.</p><h3class="anchor anchorWithStickyNavbar_LWe7"id="facebook-auth-provider">Facebook Auth Provider<ahref="#facebook-auth-provider"class="hash-link"aria-label="Direct link to Facebook Auth Provider"title="Direct link to Facebook Auth Provider"></a></h3><ol><li>Create a new FB App from <ahref="https://developers.facebook.com/"target="_blank"rel="noopener noreferrer">https://developers.facebook.com/</a></li><li>Under FB Login, set your Valid OAuth redirect URIs to <code>https://internal.yourcompany.com/oauth2/callback</code></li></ol><h3class="anchor anchorWithStickyNavbar_LWe7"id="github-auth-provider">GitHub Auth Provider<ahref="#github-auth-provider"class="hash-link"aria-label="Direct link to GitHub Auth Provider"title="Direct link to GitHub Auth Provider"></a></h3><ol><li>Create a new project: <ahref="https://github.com/settings/developers"target="_blank"rel="noopener noreferrer">https://github.com/settings/developers</a></li><li>Under <code>Authorization callback URL</code> enter the correct url ie <code>https://internal.yourcompany.com/oauth2/callback</code></li></ol><p>The GitHub auth provider supports two additional ways to restrict authentication to either organization and optional team level access, or to collaborators of a repository. Restricting by these options is normally accompanied with <code>--email-domain=*</code></p><p>NOTE: When <code>--github-user</code> is set, the specified users are allowed to login even if they do not belong to the specified org and team or collaborators.</p><p>To restrict by organization only, include the following flag:</p><divclass="codeBlockContainer_Ckt0 theme-code-block"style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><divclass="codeBlockContent_biex"><pretabindex="0"class="prism-code language-text codeBlock_bY9V thin-scrollbar"><codeclas
flags can be used to specify which groups to limit access to.</p><p>If these are unset but a <code>groups</code> mapper is set up above in step (3), the provider will still
populate the <code>X-Forwarded-Groups</code> header to your upstream server with the <code>groups</code> data in the
Keycloak userinfo endpoint response.</p><p>The group management in keycloak is using a tree. If you create a group named admin in keycloak
<!---->The <code>aud</code> claim specifies the intended recipient of the token, and OAuth2 Proxy expects a match against the values of either <code>--client-id</code> or <code>--oidc-extra-audience</code>.</p><p><em>In Keycloak, claims are added to JWT tokens through the use of mappers at either the realm level using "client scopes" or through "dedicated" client mappers.</em></p><p><strong>Creating the client</strong></p><ol><li>Create a new OIDC client in your Keycloak realm by navigating to:<br><strong>Clients</strong> -><strong>Create client</strong></li></ol><ul><li><strong>Client Type</strong>'OpenID Connect'</li><li><strong>Client ID</strong><code><your client's id></code>, please complete the remaining fields as appropriate and click <strong>Next</strong>.<ul><li><strong>Client authentication</strong>'On'</li><li><strong>Authentication flow</strong><ul><li><strong>Standard flow</strong>'selected'</li><li><strong>Direct access grants</strong>'deselect'<ul><li><em>Save the configuration.</em></li></ul></li></ul></li><li><strong>Settings / Access settings</strong>:<ul><li><strong>Valid redirect URIs</strong><code>https://internal.yourcompany.com/oauth2/callback</code><ul><li><em>Save the configuration.</em></li></ul></li></ul></li><li>Under the <strong>Credentials</strong> tab you will now be able to locate <code><your client's secret></code>.</li></ul></li></ul><olstart="2"><li>Configure a dedicated <em>audience mapper</em> for your client by navigating to <strong>Clients</strong> -><strong><your client's id></strong> -><strong>Client scopes</strong>.</li></ol><ul><li>Access the dedicated mappers pane by clicking <strong><your client's id>-dedicated</strong>, located under <em>Assigned client scope</em>.<br><em>(It should have a description of "Dedicated scope and mappers for this client")</em><ul><li>Click <strong>Configure a new mapper</strong> and select <strong>Audience</strong><ul><li><strong>Name</strong>'aud-mapper-<your client's id>'</li><li><strong>Included Client Audience</strong> select <code><your client's id></code> from the dropdown.<ul><li><em>OAuth2 proxy can be set up to pass both the access and ID JWT tokens to your upstream services.
If you require additional audience entries, you can use the <strong>Included Custom Audience</strong> field in addition to the "Included Client Audience" dropdown. Note that the "aud" claim of a JWT token should be limited and only specify its intended recipients.</em></li></ul></li><li><strong>Add to ID token</strong>'On'</li><li><strong>Add to access token</strong>'On' - <ahref="https://github.com/oauth2-proxy/oauth2-proxy/pull/1916"target="_blank"rel="noopener noreferrer">#1916</a><ul><li><em>Save the configuration.</em></li></ul></li></ul></li></ul></li><li>Any subsequent dedicated client mappers can be defined by clicking <strong>Dedicated scopes</strong> -><strong>Add mapper</strong> -><strong>By configuration</strong> -><em>Select mapper</em></li></ul><p>You should now be able to create a test user in Keycloak and get access to the OAuth2 Proxy instance, make sure to set an email address matching <code><yourcompany.com></code> and select <em>Email verified</em>.</p><p><strong>Authorization</strong></p><p><em>OAuth2 Proxy will perform authorization by requiring a valid user, this authorization can be extended to take into account a user's membership in Keycloak <code>groups</code>, <code>realm roles</code>, and <code>client roles</code> using the keycloak-oidc provider options<br><code>--allowed-role</code> or <code>--allowed-group</code></em></p><p><strong>Roles</strong></p><p><em>A standard Keycloak installation comes with the required mappers for <strong>realm roles</strong> and <strong>client roles</strong> through the pre-defined client scope "roles".
This ensures that any roles assigned to a user are included in the <code>JWT</code> tokens when using an OIDC client that has the "Full scope allowed" feature activated, the feature is enabled by default.</em></p><p><em>Creating a realm role</em></p><ul><li>Navigate to <strong>Realm roles</strong> -><strong>Create role</strong><ul><li><strong>Role name</strong>, <em><code><realm role name></code></em> -><strong>save</strong></li></ul></li></ul><p><em>Creating a client role</em></p><ul><li>Navigate to <strong>Clients</strong> -><code><your client's id></code> -><strong>Roles</strong> -><strong>Create role</strong><ul><li><strong>Role name</strong>, <em><code><client role name></code></em> -><strong>save</strong></li></ul></li></ul><p><em>Assign a role to a user</em></p><p><strong>Users</strong> -><em>Username</em> -><strong>Role mapping</strong> -><strong>Assign role</strong> -><em>filter by roles or clients and select</em> -><strong>Assign</strong>.</p><p>Keycloak "realm roles" can be authorized using the <code>--allowed-role=<realm role name></code> option, while "client roles" can be evaluated using <code>--allowed-role=<your client's id>:<client role name></code>.</p><p>You may limit the <em>realm roles</em> included in the JWT tokens for any given client by navigating to:<br>
<!---->Disabling <strong>Full scope allowed</strong> activates the <strong>Assign role</strong> option, allowing you to select which roles, if assigned to a user, will be included in the user's JWT tokens. This can be useful when a user has many associated roles, and you want to reduce the size and impact of the JWT token.</p><p><strong>Groups</strong></p><p>You may also do authorization on group memberships by using the OAuth2 Proxy option <code>--allowed-group</code>.<br>
<!---->We will only do a brief description of creating the required <em>client scope</em><strong>groups</strong> and refer you to read the Keycloak documentation.</p><p>To summarize, the steps required to authorize Keycloak group membership with OAuth2 Proxy are as follows:</p><ul><li>Create a new Client Scope with the name <strong>groups</strong> in Keycloak.<ul><li>Include a mapper of type <strong>Group Membership</strong>.</li><li>Set the "Token Claim Name" to <strong>groups</strong> or customize by matching it to the <code>--oidc-groups-claim</code> option of OAuth2 Proxy.</li><li>If the "Full group path" option is selected, you need to include a "/" separator in the group names defined in the <code>--allowed-group</code> option of OAuth2 Proxy. Example: "/groupname" or "/groupname/childgroup".</li></ul></li></ul><p>After creating the <em>Client Scope</em> named <em>groups</em> you will need to attach it to your client.<br>
<strong>Clients</strong> -><code><your client's id></code> -><strong>Client scopes</strong> -><strong>Add client scope</strong> -> Select <strong>groups</strong> and choose Optional and you should now have a client that maps group memberships into the JWT tokens so that Oauth2 Proxy may evaluate them.</p><p>Create a group by navigating to <strong>Groups</strong> -><strong>Create group</strong> and <em>add</em> your test user as a member.</p><p>The OAuth2 Proxy option <code>--allowed-group=/groupname</code> will now allow you to filter on group membership</p><p>Keycloak also has the option of attaching roles to groups, please refer to the Keycloak documentation for more information.</p><p><strong>Tip</strong></p><p>To check if roles or groups are added to JWT tokens, you can preview a users token in the Keycloak console by following these steps:
<!---->Select a <em>realm user</em> and optional <em>scope parameters</em> such as groups, and generate the JSON representation of an access or id token to examine its contents.</p><h3class="anchor anchorWithStickyNavbar_LWe7"id="gitlab-auth-provider">GitLab Auth Provider<ahref="#gitlab-auth-provider"class="hash-link"aria-label="Direct link to GitLab Auth Provider"title="Direct link to GitLab Auth Provider"></a></h3><p>This auth provider has been tested against Gitlab version 12.X. Due to Gitlab API changes, it may not work for version prior to 12.X (see <ahref="https://github.com/oauth2-proxy/oauth2-proxy/issues/994"target="_blank"rel="noopener noreferrer">994</a>).</p><p>Whether you are using GitLab.com or self-hosting GitLab, follow <ahref="https://docs.gitlab.com/ce/integration/oauth_provider.html"target="_blank"rel="noopener noreferrer">these steps to add an application</a>. Make sure to enable at least the <code>openid</code>, <code>profile</code> and <code>email</code> scopes, and set the redirect url to your application url e.g. <ahref="https://myapp.com/oauth2/callback"target="_blank"rel="noopener noreferrer">https://myapp.com/oauth2/callback</a>.</p><p>If you need projects filtering, add the extra <code>read_api</code> scope to your application.</p><p>The following config should be set to ensure that the oauth will work properly. To get a cookie secret follow <ahref="/oauth2-proxy/docs/configuration/overview#generating-a-cookie-secret">these steps</a></p><divclass="codeBlockContainer_Ckt0 theme-code-block"style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><divclass="codeBlockContent_biex"><pretabindex="0"class="prism-code language-text codeBlock_bY9V thin-scrollbar"><codeclass="codeBlockLines_e6Vv"><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> --provider="gitlab"</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> --redirect-url="https://myapp.com/oauth2/callback" // Should be the same as the redirect url for the application in gitlab</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> --client-id=GITLAB_CLIENT_ID</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> --client-secret=GITLAB_CLIENT_SECRET</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> --cookie-secret=COOKIE_SECRET</span><br></span></code></pre><divclass="buttonGroup__atx"><buttontype="button"aria-label="Copy code to clipboard"title="Copy"class="clean-btn"><spanclass="copyButtonIcons_eSgA"aria-hidden="true"><svgviewBox="0 0 24 24"class="copyButtonIcon_y97N"><pathfill="currentColor"d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svgviewBox="0 0 24 24"class="copyButtonSuccessIcon_LjdS"><pathfill="currentColor"d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Restricting by group membership is possible with the following option:</p><divclass="codeBlockContainer_Ckt0 theme-code-block"style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><divclass="codeBlockContent_biex"><pretabindex="0"class="prism-code language-text codeBlock_bY9V thin-scrollbar"><codeclass="codeBlockLines_e6Vv"><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">--gitlab-group="mygroup,myothergroup": restrict logins to members of any of these groups (slug), separated by a comma</span><br></span></code></pre><divclass="buttonGroup__atx"><buttontype="button"aria-label="Copy code to clipboard"title="Copy"class="clean-btn"><spanclass="copyButtonIcons_eSgA"aria-hidden="true"><svgviewBox="0 0 24 24"class="copyButtonIcon_y97N"><pathfill="currentColor"d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svgviewBox="0 0 24 24"
The OpenID Connect Provider (OIDC) can also be used to connect to other Identity Providers such as Okta, an example can be found below.</p><h4class="anchor anchorWithStickyNavbar_LWe7"id="dex">Dex<ahref="#dex"class="hash-link"aria-label="Direct link to Dex"title="Direct link to Dex"></a></h4><p>To configure the OIDC provider for Dex, perform the following steps:</p><ol><li><p>Download Dex:</p><divclass="codeBlockContainer_Ckt0 theme-code-block"style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><divclass="codeBlockContent_biex"><pretabindex="0"class="prism-code language-text codeBlock_bY9V thin-scrollbar"><codeclass="codeBlockLines_e6Vv"><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">go get github.com/dexidp/dex</span><br></span></code></pre><divclass="buttonGroup__atx"><buttontype="button"aria-label="Copy code to clipboard"title="Copy"class="clean-btn"><spanclass="copyButtonIcons_eSgA"aria-hidden="true"><svgviewBox="0 0 24 24"class="copyButtonIcon_y97N"><pathfill="currentColor"d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svgviewBox="0 0 24 24"class="copyButtonSuccessIcon_LjdS"><pathfill="currentColor"d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>See the <ahref="https://dexidp.io/docs/getting-started/"target="_blank"rel="noopener noreferrer">getting started guide</a> for more details.</p></li><li><p>Setup oauth2-proxy with the correct provider and using the default ports and callbacks. Add a configuration block to the <code>staticClients</code> section of <code>examples/config-dev.yaml</code>:</p><divclass="codeBlockContainer_Ckt0 theme-code-block"style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><divclass="codeBlockContent_biex"><pretabindex="0"class="prism-code language-text codeBlock_bY9V thin-scrollbar"><codeclass="codeBlockLines_e6Vv"><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">- id: oauth2-proxy</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">redirectURIs:</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">- 'http://127.0.0.1:4180/oauth2/callback'</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">name: 'oauth2-proxy'</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">secret: proxy</span><br></span></code></pre><divclass="buttonGroup__atx"><buttontype="button"aria-label="Copy code to clipboard"title="Copy"class="clean-btn"><spanclass="copyButtonIcons_eSgA"aria-hidden="true"><svgviewBox="0 0 24 24"class="copyButtonIcon_y97N"><pathfill="currentColor"d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svgviewBox="0 0 24 24"class="copyButtonSuccessIcon_LjdS"><pathfill="currentColor"d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Launch Dex: from <code>$GOPATH/github.com/dexidp/dex</code>, run:</p><divclass="codeBlockContainer_Ckt0 theme-code-block"style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><divclass="codeBlockContent_biex"><pretabindex="0"class="prism-code language-text codeBlock_bY9V thin-scrollbar"><codeclass="codeBlockLines_e6Vv"><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">bin/dex serve examples/config-dev.yaml</span><br></span></code></pre><divclass="buttonGroup__atx"><buttontype="button"aria-label="Copy code to clipboard"title="Copy"class="clean-btn"><spanclass="copyButtonIcons_eSgA"aria-hidden="true"><svgviewBox="0 0 24 24"class="copyButtonIcon_y97N"><pathfill="currentColor"d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svgviewBox="0
you may wish to configure an authorization server for each application. Otherwise, the provided <code>default</code> will work.</li></ol><ul><li>Navigate to <strong>Security</strong> then select <strong>API</strong></li><li>Click <strong>Add Authorization Server</strong>, if this option is not available you may require an additional license for a custom authorization server.</li><li>Fill out the <strong>Name</strong> with something to describe the application you are protecting. e.g. 'Example App'.</li><li>For <strong>Audience</strong>, pick the URL of the application you wish to protect: <ahref="https://example.corp.com"target="_blank"rel="noopener noreferrer">https://example.corp.com</a></li><li>Fill out a <strong>Description</strong></li><li>Add any <strong>Access Policies</strong> you wish to configure to limit application access.</li><li>The default settings will work for other options.
<ahref="https://developer.okta.com/docs/guides/customize-authz-server/overview/"target="_blank"rel="noopener noreferrer">See Okta documentation for more information on Authorization Servers</a></li></ul><olstart="3"><li>Navigate to <strong>Applications</strong> then select <strong>Add Application</strong>.</li></ol><ul><li>Select <strong>Web</strong> for the <strong>Platform</strong> setting.</li><li>Select <strong>OpenID Connect</strong> and click <strong>Create</strong></li><li>Pick an <strong>Application Name</strong> such as <code>Example App</code>.</li><li>Set the <strong>Login redirect URI</strong> to <code>https://example.corp.com</code>.</li><li>Under <strong>General</strong> set the <strong>Allowed grant types</strong> to <code>Authorization Code</code> and <code>Refresh Token</code>.</li><li>Leave the rest as default, taking note of the <code>Client ID</code> and <code>Client Secret</code>.</li><li>Under <strong>Assignments</strong> select the users or groups you wish to access your application.</li></ul><olstart="4"><li><p>Create a configuration file like the following:</p><divclass="codeBlockContainer_Ckt0 theme-code-block"style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><divclass="codeBlockContent_biex"><pretabindex="0"class="prism-code language-text codeBlock_bY9V thin-scrollbar"><codeclass="codeBlockLines_e6Vv"><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">provider = "oidc"</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">redirect_url = "https://example.corp.com/oauth2/callback"</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">oidc_issuer_url = "https://corp.okta.com/oauth2/abCd1234"</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">upstreams = [</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">"https://example.corp.com"</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">]</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">email_domains = [</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">"corp.com"</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">]</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">client_id = "XXXXX"</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">client_secret = "YYYYY"</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">pass_access_token = true</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">cookie_secret = "ZZZZZ"</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">skip_provider_button = true</span><br></span></code></pre><divclass="buttonGroup__atx"><buttontype="button"aria-label="Copy code to clipboard"title="Copy"class="clean-btn"><spanclass="copyButtonIcons_eSgA"aria-hidden="true"><svgviewBox="0 0 24 24"class="copyButtonIcon_y97N"><pathfill="currentColor"d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svgviewBox="0 0 24 24"class="copyButtonSuccessIcon_LjdS"><pathfill="currentColor"d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ol><p>The <code>oidc_issuer_url</code> is based on URL from your <strong>Authorization Server</strong>'s <strong>Issuer</strong> field in step 2, or simply <ahref="https://corp.okta.com"target="_blank"rel="noopener noreferrer">https://corp.okta.com</a> .
Generate a unique <code>cookie_secret</code> to encrypt the cookie.</p><p>Then you can start the oauth2-proxy with <code>./oauth2-proxy --config /etc/example.cfg</code></p><h4class="anchor anchorWithStickyNavbar_LWe7"id="okta---localhost">Okta - localhost<ahref="#okta---localhost"class="hash-link"aria-label="Direct link to Okta - localhost"title="Direct link to Okta - localhost"></a></h4><ol><li>Signup for developer account: <ahref="https://developer.okta.com/signup/"target="_blank"rel="noopener noreferrer">https://developer.okta.com/signup/</a></li><li>Create New <code>Web</code> Application: https://${your-okta-domain}/dev/console/apps/new</li><li>Example Application Settings for localhost:<ul><li><strong>Name:</strong> My Web App</li><li><strong>Base URIs:</strong> http://localhost:4180/</li><li><strong>Login redirect URIs:</strong> http://localhost:4180/oauth2/callback</li><li><strong>Logout redirect URIs:</strong> http://localhost:4180/</li><li><strong>Group assignments:</strong><code>Everyone</code></li><li><strong>Grant type allowed:</strong><code>Authorization Code</code> and <code>Refresh Token</code></li></ul></li><li>Make note of the <code>Client ID</code> and <code>Client secret</code>, they are needed in a future step</li><li>Make note of the <strong>default</strong> Authorization Server Issuer URI from: https://${your-okta-domain}/admin/oauth2/as</li><li>Example config file <code>/etc/localhost.cfg</code><divclass="codeBlockContainer_Ckt0 theme-code-block"style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><divclass="codeBlockContent_biex"><pretabindex="0"class="prism-code language-text codeBlock_bY9V thin-scrollbar"><codeclass="codeBlockLines_e6Vv"><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">provider = "oidc"</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">redirect_url = "http://localhost:4180/oauth2/callback"</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">oidc_issuer_url = "https://${your-okta-domain}/oauth2/default"</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">upstreams = [</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">"http://0.0.0.0:8080"</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">]</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">email_domains = [</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">"*"</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">]</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">client_id = "XXX"</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">client_secret = "YYY"</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">pass_access_token = true</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">cookie_secret = "ZZZ"</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">cookie_secure = false</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">skip_provider_button = true</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"># Note: use the following for testing within a container</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"># http_address = "0.0.0.0:4180"</span><br></span></code></pre><divclass="buttonGroup__atx"><buttontype="button"aria-label="Copy code to clipboard"title="Copy"class="clean-btn"><spanclass="copyButtonIcons_eSgA"aria-hidden="true"><svgviewBox="0 0 24 24"class="copyButtonIcon_y97N"><pathfill="currentColor"d="M19,21H8V7H19M19,5H8A2,200,06,7V21A2,200,08,23
If you are a US Government agency, you can contact the login.gov team through the contact information
that you can find on <ahref="https://login.gov/developers/"target="_blank"rel="noopener noreferrer">https://login.gov/developers/</a> and work with them to understand how to get login.gov
accounts for integration/test and production access.</p><p>A developer guide is available here: <ahref="https://developers.login.gov/"target="_blank"rel="noopener noreferrer">https://developers.login.gov/</a>, though this proxy handles everything
but the data you need to create to register your application in the login.gov dashboard.</p><p>As a demo, we will assume that you are running your application that you want to secure locally on
http://localhost:3000/, that you will be starting your proxy up on http://localhost:4180/, and that
you have an agency integration account for testing.</p><p>First, register your application in the dashboard. The important bits are:</p><ul><li>Identity protocol: make this <code>Openid connect</code></li><li>Issuer: do what they say for OpenID Connect. We will refer to this string as <code>${LOGINGOV_ISSUER}</code>.</li><li>Public key: This is a self-signed certificate in .pem format generated from a 2048 bit RSA private key.
A quick way to do this is <code>openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 3650 -nodes -subj '/C=US/ST=Washington/L=DC/O=GSA/OU=18F/CN=localhost'</code>,
The contents of the <code>key.pem</code> shall be referred to as <code>${OAUTH2_PROXY_JWT_KEY}</code>.</li><li>Return to App URL: Make this be <code>http://localhost:4180/</code></li><li>Redirect URIs: Make this be <code>http://localhost:4180/oauth2/callback</code>.</li><li>Attribute Bundle: Make sure that email is selected.</li></ul><p>Now start the proxy up with the following options:</p><divclass="codeBlockContainer_Ckt0 theme-code-block"style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><divclass="codeBlockContent_biex"><pretabindex="0"class="prism-code language-text codeBlock_bY9V thin-scrollbar"><codeclass="codeBlockLines_e6Vv"><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">./oauth2-proxy -provider login.gov \</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -client-id=${LOGINGOV_ISSUER} \</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -redirect-url=http://localhost:4180/oauth2/callback \</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -oidc-issuer-url=https://idp.int.identitysandbox.gov/ \</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -cookie-secure=false \</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -email-domain=gsa.gov \</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -upstream=http://localhost:3000/ \</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -cookie-secret=somerandomstring12341234567890AB \</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -cookie-domain=localhost \</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -skip-provider-button=true \</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -pubjwk-url=https://idp.int.identitysandbox.gov/api/openid_connect/certs \</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -profile-url=https://idp.int.identitysandbox.gov/api/openid_connect/userinfo \</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -jwt-key="${OAUTH2_PROXY_JWT_KEY}"</span><br></span></code></pre><divclass="buttonGroup__atx"><buttontype="button"aria-label="Copy code to clipboard"title="Copy"class="clean-btn"><spanclass="copyButtonIcons_eSgA"aria-hidden="true"><svgviewBox="0 0 24 24"class="copyButtonIcon_y97N"><pathfill="currentColor"d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svgviewBox="0 0 24 24"class="copyButtonSuccessIcon_LjdS"><pathfill="currentColor"d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>You can also set all these options with environment variables, for use in cloud/docker environments.
One tricky thing that you may encounter is that some cloud environments will pass in environment
variables in a docker env-file, which does not allow multiline variables like a PEM file.
If you encounter this, then you can create a <code>jwt_signing_key.pem</code> file in the top level
directory of the repo which contains the key in PEM format and then do your docker build.
The docker build process will copy that file into your image which you can then access by
setting the <code>OAUTH2_PROXY_JWT_KEY_FILE=/etc/ssl/private/jwt_signing_key.pem</code>
environment variable, or by setting <code>--jwt-key-file=/etc/ssl/private/jwt_signing_key.pem</code> on the commandline.</p><p>Once it is running, you should be able to go to <code>http://localhost:4180/</code> in your browser,
get authenticated by the login.gov integration server, and then get proxied on to your
application running on <code>http://localhost:3000/</code>. In a real deployment, you would secure
your application with a firewall or something so that it was only accessible from the
proxy, and you would use real hostnames everywhere.</p><h4class="anchor anchorWithStickyNavbar_LWe7"id="skip-oidc-discovery">Skip OIDC discovery<ahref="#skip-oidc-discovery"class="hash-link"aria-label="Direct link to Skip OIDC discovery"title="Direct link to Skip OIDC discovery"></a></h4><p>Some providers do not support OIDC discovery via their issuer URL, so oauth2-proxy cannot simply grab the authorization, token and jwks URI endpoints from the provider's metadata.</p><p>In this case, you can set the <code>--skip-oidc-discovery</code> option, and supply those required endpoints manually:</p><divclass="codeBlockContainer_Ckt0 theme-code-block"style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><divclass="codeBlockContent_biex"><pretabindex="0"class="prism-code language-text codeBlock_bY9V thin-scrollbar"><codeclass="codeBlockLines_e6Vv"><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -provider oidc</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -client-id oauth2-proxy</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -client-secret proxy</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -redirect-url http://127.0.0.1:4180/oauth2/callback</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -oidc-issuer-url http://127.0.0.1:5556</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -skip-oidc-discovery</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -login-url http://127.0.0.1:5556/authorize</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -redeem-url http://127.0.0.1:5556/token</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -oidc-jwks-url http://127.0.0.1:5556/keys</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -cookie-secure=false</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -email-domain example.com</span><br></span></code></pre><divclass="buttonGroup__atx"><buttontype="button"aria-label="Copy code to clipboard"title="Copy"class="clean-btn"><spanclass="copyButtonIcons_eSgA"aria-hidden="true"><svgviewBox="0 0 24 24"class="copyButtonIcon_y97N"><pathfill="currentColor"d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svgviewBox="0 0 24 24"class="copyButtonSuccessIcon_LjdS"><pathfill="currentColor"d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3class="anchor anchorWithStickyNavbar_LWe7"id="nextcloud-provider">Nextcloud Provider<ahref="#nextcloud-provider"class="hash-link"aria-label="Direct link to Nextcloud Provider"title="Direct link to Nextcloud Provider"></a></h3><p>The Nextcloud provider allows you to authenticate against users in your
Nextcloud instance.</p><p>When you are using the Nextcloud provider, you must specify the urls via
configuration, environment variable, or command line argument. Depending
on whether your Nextcloud instance is using pretty urls your urls may be of the
form <code>/index.php/apps/oauth2/*</code> or <code>/apps/oauth2/*</code>.</p><p>Refer to the <ahref="https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/oauth2.html"target="_blank"rel="noopener noreferrer">OAuth2
documentation</a>
to setup the client id and client secret. Your "Redirection URI" will be
<code>https://internalapp.yourcompany.com/oauth2/callback</code>.</p><divclass="codeBlockContainer_Ckt0 theme-code-block"style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><divclass="codeBlockContent_biex"><pretabindex="0"class="prism-code language-text codeBlock_bY9V thin-scrollbar"><codeclass="codeBlockLines_e6Vv"><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -provider nextcloud</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -client-id <from nextcloud admin></span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -client-secret <from nextcloud admin></span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -login-url="<your nextcloud url>/index.php/apps/oauth2/authorize"</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -redeem-url="<your nextcloud url>/index.php/apps/oauth2/api/v1/token"</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> -validate-url="<your nextcloud url>/ocs/v2.php/cloud/user?format=json"</span><br></span></code></pre><divclass="buttonGroup__atx"><buttontype="button"aria-label="Copy code to clipboard"title="Copy"class="clean-btn"><spanclass="copyButtonIcons_eSgA"aria-hidden="true"><svgviewBox="0 0 24 24"class="copyButtonIcon_y97N"><pathfill="currentColor"d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svgviewBox="0 0 24 24"class="copyButtonSuccessIcon_LjdS"><pathfill="currentColor"d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Note: in <em>all</em> cases the validate-url will <em>not</em> have the <code>index.php</code>.</p><h3class="anchor anchorWithStickyNavbar_LWe7"id="digitalocean-auth-provider">DigitalOcean Auth Provider<ahref="#digitalocean-auth-provider"class="hash-link"aria-label="Direct link to DigitalOcean Auth Provider"title="Direct link to DigitalOcean Auth Provider"></a></h3><ol><li><ahref="https://cloud.digitalocean.com/account/api/applications"target="_blank"rel="noopener noreferrer">Create a new OAuth application</a><ul><li>You can fill in the name, homepage, and description however you wish.</li><li>In the "Application callback URL" field, enter: <code>https://oauth-proxy/oauth2/callback</code>, substituting <code>oauth2-proxy</code> with the actual hostname that oauth2-proxy is running on. The URL must match oauth2-proxy's configured redirect URL.</li></ul></li><li>Note the Client ID and Client Secret.</li></ol><p>To use the provider, pass the following options:</p><divclass="codeBlockContainer_Ckt0 theme-code-block"style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><divclass="codeBlockContent_biex"><pretabindex="0"class="prism-code language-text codeBlock_bY9V thin-scrollbar"><codeclass="codeBlockLines_e6Vv"><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> --provider=digitalocean</span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> --client-id=<Client ID></span><br></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> --client-secret=<Client Secret></span><br></span></code></pre><divclass="buttonGroup__atx"><buttontype="button"aria-label="Copy code to clipboard"title="Copy"class="clean-btn"><spanclass="copyButtonIcons_eSgA"aria-hidden="true"><svgviewBox="0 0 24 24"class="copyButtonIcon_y97N"><pathfill="currentColor"d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svgviewBox="0 0 24 24"class="copyButtonSuccessIcon_LjdS"><pathfill="currentColor"d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></d
<code>Provider</code> instance. Add a new <code>case</code> to
<ahref="https://github.com/oauth2-proxy/oauth2-proxy/blob/master/providers/providers.go"target="_blank"rel="noopener noreferrer"><code>providers.New()</code></a> to allow <code>oauth2-proxy</code> to use the