# authtokengenerator\_jslibrary

## Methods

The following API methods are provided by the AuthToken generator library

### Generate new AuthToken

```

generate: function(key, secret){}
```

Request Arguments:

```

key- "key" of the JWT Credential For ex: '398e54e888da42f8d089je28c298o42b'
secret- "secret" of the JWT Credential For ex: '07c6e2t1rb92987fnrd705jkk8582p9e'
```

### Regenerate Expired AuthToken

```

refresh: function(oldAuthToken) { }
```

### Generate JWT With Bash

Authtoken can be generated using the bash script also, for more details refer <https://willhaley.com/blog/generate-jwt-with-bash/>

## How to generate authorization credentials

This section details the procedure to generate the AuthToken and secret key that is required to access any APIs and to configure the standalone telemetry JS library.

### Process

![](/files/-MkM8nDCJs23mASphEql)

### Prerequisites

* Access to the Ekstep Community portal

### Procedure

| Step                                                                                                                                                                                                                                                                                                                                                                                                                         | Screen                           |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
| <p><strong>Sign In</strong><br>1. Sign in to Ekstep QA portal (<https://qa.ekstep.in>)<br>2. Go to Resources > Developers<br> <strong>Note:</strong> If you have already created QA credentials and tested Sunbird, and are looking at acquiring production credentials, repeat the same steps on visit <a href="https://community.ekstep.in/api-credentials"><https://community.ekstep.in/api-credentials></a> instead.</p> | ![](/files/-MkM8nDDRwo-9xjRVwDe) |
| <p><strong>Request API Access</strong><br>1. Select <strong>API credentials</strong><br>2. The <strong>Manage Credentials</strong> page is displayed<br>3. Click <strong>Request API access</strong> to request access for available API groups</p>                                                                                                                                                                          | ![](/files/-MkM8nDEx0UPoTGuB3ab) |
| <p>On successful submission of the API access request, the portal admin is notified. The admin either approves or rejects the request</p><p> You are notified of the admin’s action through a mail to your registered mail ID</p><p>You can also view the action taken, by clicking the notification icon on the portal</p>                                                                                                  | ![](/files/-MkM8nDFsF181_JPUHWr) |
| <p><strong>Generate New Credentials</strong><br>1. Enter the username<br>2. Enter notes, if any<br>3. The API groups that can be accessed with the created credentials are listed here<br>4. Click <strong>Generate credentials</strong> to generate key and secret</p>                                                                                                                                                      | ![](/files/-MkM8nDGYo5cAeo5F8Nw) |
| <p><strong>Note the Credentials</strong><br>1. Ensure to copy the key and secret and confirm the same<br>2. Click <strong>Close</strong> after copying the Key and Secret</p>                                                                                                                                                                                                                                                | ![](/files/-MkM8nDHT5ctrNPpJs43) |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://telemetry.sunbird.org/use/authtokengenerator_jslibrary.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
