Skip to content
Snippets Groups Projects
Commit fb9a0d6d authored by Madalyn Marabella's avatar Madalyn Marabella
Browse files

add aws-jwt-client

parent 40da3f10
No related branches found
No related tags found
2 merge requests!487Draft: Create unique legal tag with timestamp,!484create unique legal tag with timestamp
Pipeline #178968 passed
import os
import boto3
import jwt
def get_id_token():
client = boto3.client('cognito-idp', region_name=os.environ["AWS_REGION"])
userAuth = client.initiate_auth(
ClientId= os.environ['AWS_COGNITO_CLIENT_ID'],
AuthFlow= os.environ['AWS_COGNITO_AUTH_FLOW'],
AuthParameters= {
"USERNAME": os.environ['AWS_COGNITO_AUTH_PARAMS_USER'],
"PASSWORD": os.environ['AWS_COGNITO_AUTH_PARAMS_PASSWORD']
})
print(userAuth['AuthenticationResult']['AccessToken'])
def get_invalid_token():
#generate a dummy jwt
return jwt.encode({'some': 'payload'}, 'secret', algorithm='HS256').decode("utf-8")
if __name__ == '__main__':
get_id_token()
boto3==1.14.40
PyJWT==1.7.1
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment