---
updatedAt: 2026-10-22T09:02:56.000Z
agentTools:
  projectIndex: https://progbat.readme.io/llms.txt
---

# Authentication

OAuth2.0

This API implements the OAuth2.0 protocol. Every request on this API must have a header "Authorization" with a bearer token :

`Authorization: Bearer {token}`

<br />

# Get an access token

To get a token, there are two different ways, depending on the type of application you created

## For a private application

When you  created a private application, the application is linked to your company and user account, with the privileges the creator have on the company account. This type of application does not need to follow the standard Oauth2.0 login protocol to generate a token, you can directly use the private token of your application as a bearer token, to call the API routes.

![]()

To get your private token, do on your "Portail développeur ProGbat" page on the application, and copy the property "Jeton d'accès privé".

![](https://files.readme.io/cd2f7c26a284cab637eaa134e8ad919a99e83afc49ae2c0ca3032167e5f1e769-Capture_dcran_du_2026-09-16_12-26-48.png)

<br />

<br />

## For a public application

To generate a token from a public application, simply implement the Oauth2.0 login protocol with the following information :

Auth URL : <https://api.progbat.com/v2/auth>

Token URL: <https://api.progbat.com/v2/token>

<br />

### Step1 - Authenticate the user

To generate a user token, your must first redirect the user to <https://api.progbat.com/v2/auth> with the following query parameters :

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Parameter
      </th>

      <th>
        Required
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        client_id
      </td>

      <td>
        :white_check_mark:
      </td>

      <td>
        The id of your application (provided by our team).
      </td>
    </tr>

    <tr>
      <td>
        scope
      </td>

      <td>
        ✅
      </td>

      <td>
        The scopes you want access with the token that will be generated, comma separated.
      </td>
    </tr>

    <tr>
      <td>
        response_type
      </td>

      <td>
        ✅
      </td>

      <td>
        Must be the string "code"
      </td>
    </tr>

    <tr>
      <td>
        redirect_uri
      </td>

      <td>
        ✅
      </td>

      <td>
        The endpoint the user will be redirected after authentication. On this endpoint, the token will be generated.
      </td>
    </tr>

    <tr>
      <td>
        state
      </td>

      <td>
        ✅
      </td>

      <td>
        A random string that will be returned to redirect_uri to ensure the authentication process security
      </td>
    </tr>

    <tr>
      <td>
        pompt
      </td>

      <td>

      </td>

      <td>
        * "login" to force the user to login event if already logged in on the browser
        * "select_account" (default) to let user select its logged account
        * "consent" to display the validation scope page
        * "none" to pass throw all steps if the user is alraedy logged in and have accepted the scopes
      </td>
    </tr>
  </tbody>
</Table>

<br />

### Step 2 : Generate a token

Once the user is authenticated and has validated the scope to accept your application access to his data on ProGBat, it will be redirected to the provided redirect\_uri.

To generate the token, make a request POST <https://api.progbat.com/v2/token>.  with the following body (JOSN or form urlencoded are accepted):

```json
{
  "client_id" : "{your client id}",
  "client_secret" : "{your client secret}",
  "grant_type": "authorization_code",
  "code" : "{The code received by query string}",
  "redirect_uri" : "{The same redirect_uri as provided on authentication page}"
}
```

The response will be a JSON like

```json
{
  "access_token": "string",
  "refresh_token": "string",
  "token_type": "string",
  "expires_in": 0
}
```

The property `access_token` has to be set in the next API calls, in the header `Authorization: Bearer {access_token}`

The property `refresh_token` has to be stored on your system, to be used to refresh token later.

<br />

### Refresh a token

When generating token from an authorization code, an access\_token and a refresh\_token are returned by the API. The refresh\_token can be stored in your system to generate a new token later, without user authentication.

To refresh a token, make a request POST <https://api.progbat.com/v2/token> with the following body :

```json
{
  "client_id" : "{your client id}",
  "client_secret" : "{your client secret}",
  "grant_type": "refresh_token",
  "refresh_token": "{The stored refresh_token}"
}

```

<br />

A refresh token can be used 50 times before expiration. At the 50th usage, a nex refresh\_token is created and the old one is invalidated. It means that you need to store the new returned refresh\_token for your future requests.

<br />

### Révoquer un token

You can revoke a refresh token to avoid it to generate new access tokens.&#x20;

To revoke a token, make a request POST [https://api.progbat.com/v2/token/revoke](https://api.progbat.com/v2/token) with the following body

```json json
{
  "client_id" : "{your client id}",
  "refresh_token" : "{The token to revoke}"
}
```