# M2M JWT generation script

M2M JWT generation script to generate JWT token and expiration time.

## Description

If we need to manually create new JWT tokens for the ows communications, please follow these directions:

## Usage

1. Copy .env.shadow to .env
2. Fill in the values for AUTH0_M2M_CLIENT_ID, M2M_CLIENT_SECRET_NAME, and AUTH0_API_AUDIENCE (if needed).

   The client id can be found in the Auth0 dashboard, go to the Applications link on the left sideboard. Find the ows-machine-to-machine application.

   The client secret name is the actually the client secret from Auth0 - go into the settings for the ows-machine-to-machine application, and you can copy the client secret from there.

   For production, the AUTH0_API_AUDIENCE should be: `https://prod-ows.theorchard.io`

3. After those are set, you can run the script: python m2m_jwt_refresh.py

4. The output of the script will print the generated JWT token, and the token expiration time.

   These will need to be written into AWS secrets manager, in these secrets:

   `ENV/lambda-jwt-refresh/jwt_token`

   `ENV/lambda-jwt-refresh/jwt_token_expiration`

    Please change `ENV` value to `qa` or `prod` depending on set `Environment` in .env file.

The microservices will pick up the new token from secrets manager after that.
