Authorization

Modjoule will provide userpool Id and relevant configurations. Users need to authenticate from modjoul identity providers. eg: Following NodeJs code will generate the authorization token.

var http = require('http');
global.fetch = require('node-fetch');
global.navigator = () => null;
const AmazonCognitoIdentity = require('amazon-cognito-identity-js');
const poolData = {
    UserPoolId: 'your-pool-id',
    ClientId: 'your-client-id',
};

const userPool = new AmazonCognitoIdentity.CognitoUserPool(poolData);

const login = function () {
    var userName = 'username';
    var password = 'password';

    var authenticationDetails = new AmazonCognitoIdentity.AuthenticationDetails({
        Username: userName,
        Password: password,
    });
    var userData = {
        Username: userName,
        Pool: userPool,
    };
    var cognitoUser = new AmazonCognitoIdentity.CognitoUser(userData);
    cognitoUser.authenticateUser(authenticationDetails, {
        onSuccess: function (result) {
            let idToken = result.idToken.jwtToken;
            console.log(idToken); //this is the one you should send
        },
        onFailure: function (err) {
            console.log(err);
        },
        newPasswordRequired: function (userAttributes) {
            delete userAttributes.email_verified;
            cognitoUser.completeNewPasswordChallenge(
                'new-password',
                userAttributes,
                this
            );
        },
    });
};

login();

The generated token should go in authorization header.

cURL
curl -X GET \
  https://your-api-url-here \
  -H 'Authorization: your-authorization-token-here' 
Postman
GET your-api-end-point-here HTTP/1.1
Host: your-base-api-url-here
Authorization: your-authorization-token-here