# Generate an OAuth 2.0 JSON Web Token
source: https://developer.mastercard.com/riskrecon-api/documentation/tutorials-and-guides/generate-oauth-bearer-tokens-tutorial/index.md

### Pre-requisites {#pre-requisites}

You must have administrator privileges to be able to generate an OAuth 2.0 JSON Web Token (JWT) token from the [RiskRecon web portal](https://auth.riskrecon.com/users/sign_in).

### Overview {#overview}

RiskRecon generates the JWT for you using the `POST API_KEYS` endpoint. This endpoint is automatically called when you send the request to generate the JWT.

Here is an example of the request payload of the `POST API_KEYS` endpoint:

```json
{   
    description: "testing", 
    expiration_date: "1 Year"
}
```

This request generates the JWT using the private key that is in custody of the OAuth 2.0 server. To create the JWT, the HTTPS Client provides the public key to the OAuth 2.0 server. The public key is encrypted by the HTTPS server using the private key.

The JWT is signed and generated by OAuth 2.0 using the private RS256 key. The OAuth 2.0 policy generates and returns a Base64-encoded JWT signed using the private RS256 key.

You can use this JWT as an OAuth 2.0 bearer token to make RiskRecon API calls.

To move to the next step in the tutorial, click the subsequent step in the left navigation pane or click the **Next** button.

## Log in to RiskRecon Web Portal {#log-in-to-riskrecon-web-portal}

Log in to the [RiskRecon web portal](https://auth.riskrecon.com/users/sign_in) as an administrator.

If you do not have access to log in to the web portal, you must contact the [RiskRecon customer care](mailto:support@riskrecon.com) to create an account for you.

## Create the API Key {#create-the-api-key}

You can create the OAuth bearer token in JWT format from the **API Keys** page.

Follow these steps to navigate to the **API Keys** page:

1. As an administrator, select **System Administration** from the **My Account** drop-down list. ![](https://static.developer.mastercard.com/content/riskrecon-api/uploads/login-to-my-account.png)
2. Select **API Keys** tab from the **System Administrator** page. ![](https://static.developer.mastercard.com/content/riskrecon-api/uploads/select-api-keys.png)
3. Select **New API Key** button from the **API Keys** page. ![](https://static.developer.mastercard.com/content/riskrecon-api/uploads/select-new-api-key.png)
4. On the **API Keys** page, enter the purpose of the of API Key in the **Description** box. ![](https://static.developer.mastercard.com/content/riskrecon-api/uploads/api-key-purpose.png)
5. Select the API key validity period from the **Select key expiration** drop-down list.   
   The API key will expire after this validity period and you would need to create a new API key.   
   You will be notified via email 7 days in advance before the expiry of the key asking you to generate a new one. ![](https://static.developer.mastercard.com/content/riskrecon-api/uploads/select-api-key-expiration.png)
6. Click **Create API Key** . ![](https://static.developer.mastercard.com/content/riskrecon-api/uploads/create-api-key.png)

The API Key is generated in JWT format and appears in **API Keys** section of the **System Administrator** page.  

7. Click the **Copy** icon next to the listed API Key to copy and save it.
