{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":40464,"path":"platform-security/authentication/configure-an-oauth-authorization-code-grant.md","title":"Configure an OAuth authorization code grant","bundle":null,"doc_type":null,"release":"australia","body":"\n# Configure an OAuth authorization code grant\n\nConfigure the OAuth authorization code grant to enable secure and interactive user authentication to enable applications to access resources on behalf of users. The OAuth authorization code grant verifies that the API access is granted based on the user identity and permissions.\n\n## Before you begin\n\nRole required: `oauth_admin, mi_admin, admin`\n\n## Procedure\n\n1.  Navigate to **Machine Identity Console** &gt; **Inbound integrations** &gt; **New integration** &gt; **OAuth - Authorization code grant**.\n\n2.  Update the text fields in the Details form with the appropriate information.\n\n<table id=\"table_nwn_z3x_r2c\"><thead><tr><th>\n\nField\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\n**Name of OAuth entity**\n\n</td><td>\n\nName of the OAuth entity.\n\n</td></tr><tr><td>\n\n**Provider name**\n\n</td><td>\n\nEnter the name of the service provider you want to integrate with. Example: Microsoft, Google, Zoom, SAP, etc.**Note:** Provider name is a mandatory field.\n\n</td></tr><tr><td>\n\n**Redirect URL**\n\n</td><td>\n\nURL to which the authorization code should be sent after authentication.\n\n</td></tr><tr><td>\n\n**Client ID**\n\n</td><td>\n\nUnique ID assigned to identify the application.\n\n</td></tr><tr><td>\n\n**Client Secret**\n\n</td><td>\n\nThe secret key that only the application and the authorization server can identify. The application uses this key to authenticate and obtain access tokens.\n\n</td></tr><tr><td>\n\n**Comments**\n\n</td><td>\n\nAdd any notes about this configuration.\n\n</td></tr><tr><td>\n\n**Active**\n\n</td><td>\n\nSelect to use for authentication and authorization requests; when unselected, the record is saved but remains inactive and will not process any requests.\n\n</td></tr><tr><td>\n\n**This is a public client check box**\n\n</td><td>\n\nSelect the if the application can’t securely store credentials, and doesn’t require a secret key to prove its identity during authorization. The client secret information is processed for public clients.\n\n</td></tr></tbody>\n</table>3.  Perform the following steps to add auth scope to the configuration:\n\n    1.  Select **Create auth scope** if you want to define a new scope.\n\n    2.  Select a scope from the **Auth scope** drop-down.\n\n    3.  Enter API names in **Limit authorization to the following APIs** to narrow access.\n\n    4.  Use **+ Add another row** to assign additional scopes to your configuration.\n\n4.  Select **Allow access only to APIs in selected scope** in the Scope validation settings to restricts access to listed scopes only.\n\n    **Note:** You can choose not to select **Set Allow access only to APIs in selected scope** for broader access permitted by user controls and API policies.\n\n5.  Update the text fields in the Advanced options \\(optional\\) form with the appropriate information.\n\n<table id=\"table_qdq_bw2_s2c\"><thead><tr><th>\n\nField\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\n**Enforce token restriction**\n\n</td><td>\n\nThe Enforce token restriction option limits the client to accessing only the APIs specified in the REST API Access Policies. If you unselect it, the client can access other REST APIs based on the user ACL permissions.\n\n</td></tr><tr><td>\n\n**Token Format**\n\n</td><td>\n\nFormat of token to generate. Options: -   JWT\n-   Opaque\n**Note:**\n\n-   The jwks url is available in the location: `api/now/oauth/jwks`.\n-   The rotated \\(inactive keys\\) from jwks response is removed after 105 days default.\n\n\n</td></tr><tr><td>\n\n**Access token lifespan**\n\n</td><td>\n\nDuration \\(in seconds\\) for which the OAuth access token remains valid before it expires.**Note:** The default value is 1800 seconds.\n\n</td></tr><tr><td>\n\n**Refresh token lifespan**\n\n</td><td>\n\nDuration \\(in seconds\\) for which the OAuth refresh token remains valid before it expires.**Note:** The default value is 8,640,000 seconds.\n\n</td></tr><tr><td>\n\n**Login URL**\n\n</td><td>\n\nHTTP redirection endpoint to authenticate with the authorization server.\n\n</td></tr><tr><td>\n\n**Logo URL**\n\n</td><td>\n\nWeb address of an image that represents the application during the authentication and authorization process. It’s displayed on the authorization server's consent screen to help you recognize the requesting application.\n\n</td></tr></tbody>\n</table>    Enforcing token restriction applies limitations on how an OAuth access token can be used, enhancing security by verifying that tokens are valid only under specific conditions. Enable the **Enforce token restriction** check box to limit OAuth access tokens to specific APIs defined in the API access policy. If the Enforce token restriction is turned off, the token can be used across other REST APIs.\n\n6.  Select **Save**.\n\n    A new OAuth authorization code grant is created.\n\n\n"}}