# Custom auth providers

Appfarm supports third-party authentication by integrating with authentication providers using OAuth 2.0.

Using a custom auth provider allows you to manage users in an external directory such as Microsoft Entra ID (Azure AD). To enable custom auth you must first complete any necessary setup with the provider, and then configure the provider in Appfarm Create.

For detailed walkthroughs on how to configure a number of different providers, see [How to configure third-party authentication](https://docs.appfarm.io/how-to/authentication-and-access-control/third-party-authentication).

## **Checklist**

Follow these steps to correctly setup and configure a custom auth provider.

In your auth provider:

* Create a new application. Please refer to your provider's documentation for details.
* When creating an OAuth application, it will require at least one callback URL. Use `https://accounts.appfarm.io/v1/callback`.
* Make note of the *Client ID* and *Client Secret* provided when you create the OAuth application.

In Appfarm Create:

* Add a new custom auth provider.&#x20;
* Enter the provided *Client ID* into **Client ID**.
* Create a [secret](https://docs.appfarm.io/reference/security/secrets) to store the *Client Secret* and select it from the **Client Secret** list.
* Depending on what kind of provider you are using, fill in the **Tenant ID** or **OpenID Discovery Endpoint**.
* Add the custom auth provider in a login configuration under [Custom auth](https://docs.appfarm.io/reference/configuration/login/..#custom-auth).

## General settings

<table><thead><tr><th width="235">Setting</th><th>Description</th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>A descriptive reference used only in Appfarm Create.</td></tr><tr><td><strong>Provider</strong></td><td><p>The auth provider. The following options are available:</p><ul><li>Google</li><li>Microsoft Entra ID (Azure AD)</li><li>Auth0</li><li>Custom</li></ul></td></tr><tr><td><strong>Client ID</strong></td><td>The identifier of the application created in your auth provider. Usually this is a unique application used only to authenticate users for this Appfarm solution.</td></tr><tr><td><strong>Client Secret</strong></td><td>The secret for the application as provided by your auth provider. This value must be stored in Appfarm as a <a href="../../security/secrets">secret</a>.</td></tr><tr><td><strong>Tenant ID</strong></td><td><p>Only for <em>Microsoft Entra ID (Azure AD)</em> and <em>Auth0</em>.<br></p><p>The unique identifier for your tenant. Appfarm needs this value to fetch the configuration for this auth provider. The format of this value differs depending on your provider.</p><p></p><p><strong>Microsoft Entra ID (Azure AD)</strong><br>The identifier can be found inside the Microsoft Azure portal. The format is typically <code>XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX</code>.</p><p><br><strong>Auth0</strong><br>The identifier used in Auth0 is the entire hostname ending with <code>auth0.com</code>. For example: <code>appfarm.eu.auth0.com</code>.</p></td></tr><tr><td><strong>OpenID Discovery Endpoint</strong></td><td>Only for <em>Custom</em>.<br><br>The URL holding the configuration of your OpenID Connect Server. For example: <code>https://HOST_NAME/.well-known/openid-configuration</code><br><br><strong>Important:</strong> The hostname is used together with <strong>Client ID</strong> to uniquely identify this provider. If you change the host, users that have already logged in with this provider must log in again to be able to use credentials returned by this provider.</td></tr><tr><td><strong>Custom Scope</strong></td><td><p>By default, the following scope will be requested:</p><ul><li>openid</li><li>profile</li><li>email</li></ul><p>Add any additional scopes as needed. Note that if you need to save additional scopes to the User object (more than the name, email and phone - e.g. a Social Security Number), you may save these by adding user-specific <a href="../../../security/secrets#properties">secrets</a>. Add a new Secret, and select Secret Type <code>OAuth2 value</code>. You may then use a Service to update e.g. an Employee or Person object with these secret values after login.</p></td></tr><tr><td><strong>Remove Default Scope</strong></td><td>Remove <code>openid</code>, <code>profile</code> and <code>email</code> from scope. When selected, only scopes entered in <strong>Custom Scope</strong> will be used.</td></tr></tbody></table>

## Appfarm account options

<table><thead><tr><th width="239">Setting</th><th>Description</th></tr></thead><tbody><tr><td><strong>Auto Create Account</strong></td><td>Automatically create a <a href="../../security/users">user</a> in the solution when a new user authenticates.</td></tr><tr><td><strong>Initial Roles</strong></td><td>Assign one or more roles when a new user is created.</td></tr></tbody></table>

## Advanced options

<table><thead><tr><th width="244">Setting</th><th>Description</th></tr></thead><tbody><tr><td><strong>Disable Same Browser Validation</strong></td><td><p><strong>Warning:</strong> This option should be used with caution and an understanding of the security implications.</p><p><br>For added security Appfarm checks that a callback from a third-party authentication provider is made by the same browser that initiated the login. By selecting this option, that check will be disabled.<br><br>This might be desirable to improve the authentication user experience. If, for example, the login flow involves a magic link sent to the user's email address, the user may not open the link in the same browser that the login was initiated from. This will normally result in the login attempt failing. By disabling same browser validation, the login attempt in this case would succeed.</p></td></tr><tr><td><strong>Auth Timeout</strong></td><td><p>The amount of time a user can spend authenticating with the provider before returning to Appfarm.</p><p></p><p>Normally the default (15 minutes) will be more than sufficient. In some cases, for example when the authentication involves sending a link to email, this timeout may be too short.</p><p></p><p>The default is 900 seconds (15 minutes), and the maximum is 86400 seconds (24 hours).</p></td></tr></tbody></table>
