To call the GoMeddo Payments API, you need an access token. All authentication runs through AWS Cognito: you sign in with the username and password you receive after registration, and Cognito returns an access token.
Get an access token
The easiest way to get an access token is an InitiateAuth API call. You receive the ClientId, username, and password together with your account.
All GoMeddo Payments instances run in the AWS region Frankfurt (eu-central-1).
curl --request POST \
--url 'https://cognito-idp.eu-central-1.amazonaws.com/' \
--header 'Content-Type: application/x-amz-json-1.1' \
--header 'X-Amz-Target: AWSCognitoIdentityProviderService.InitiateAuth' \
--data '{
"AuthFlow": "USER_PASSWORD_AUTH",
"ClientId": "YOUR_CLIENT_ID",
"AuthParameters": {
"USERNAME": "YOUR_USERNAME",
"PASSWORD": "YOUR_PASSWORD"
}
}'
The response contains the access token in AuthenticationResult.AccessToken and a refresh token in AuthenticationResult.RefreshToken. Send the access token in the Authorization header of every GoMeddo Payments API call.
Renew the access token
Access tokens are valid for 1 hour. Use each token for the full hour, and don't request a new token for every API call. Before the token expires, sign in again or use the refresh token to get a new access token:
curl --request POST \
--url 'https://cognito-idp.eu-central-1.amazonaws.com/' \
--header 'Content-Type: application/x-amz-json-1.1' \
--header 'X-Amz-Target: AWSCognitoIdentityProviderService.InitiateAuth' \
--data '{
"AuthFlow": "REFRESH_TOKEN_AUTH",
"ClientId": "YOUR_CLIENT_ID",
"AuthParameters": {
"REFRESH_TOKEN": "YOUR_REFRESH_TOKEN"
}
}'
Use an AWS SDK
Instead of a raw request, you can call InitiateAuth with the AWS CLI or with the AWS SDK for your language, which speeds up your development. For more information, see the AWS documentation for your language: