Winterlight API is authenticated using AWS Cognito with API Gateway.
To access Winterlight API you need to have a username and password in the Winterlight’s AWS Cognito User pool.
To gain a Username and password, please contact someone from the infrastructure team.
To send requests to winterlight API:
- Send a request to AWS cognito to generate a token (Shown below)
- Use the Bearer token in the Authorization Header to send a request to the winterlight API
Production CLIENT_ID = 6fto8mmsmnqtpf72134dq4jk0a
Production API_URL = https://api.winterlight.gred.ai/predictions/
test CLIENT_ID = 70dv1qskhiihi3qde6p1slrl8s
test API_URL = https://api.winterlight.test.gred.ai/predictions/
USERNAME,PASSWORD should be provided by the infrastructure team
Using AWS CLI:
### Token Generation
aws cognito-idp initiate-auth \
--client-id ${CLIENT_ID} \
--auth-flow USER_PASSWORD_AUTH \
--auth-parameters USERNAME=${USERNAME},PASSWORD=${PASSWORD} \
--query 'AuthenticationResult.AccessToken' \
--output text \
--region us-west-2
### Send an API request to Winterlight API
curl -Lsi -X 'POST' \
${API_URL} \
-H "Authorization: Bearer ${TOKEN}" \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F 'file=@${FILE_DESTINATION}'