Skip to content

Commit

Permalink
Merge pull request #53 from lahirumenik/main
Browse files Browse the repository at this point in the history
add refresh token and add corrections to response
  • Loading branch information
lahirumenik authored Jan 6, 2024
2 parents c29721e + 01de22f commit 11d8310
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions backend/serverless/testing/siginauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,22 @@ exports.handler = async (event, context, callback) => {
const cognitoResponse = await cognito.initiateAuth({
AuthFlow: 'USER_PASSWORD_AUTH',
AuthParameters: {
Username: event.username,
Password: event.password,
USERNAME: event.username,
PASSWORD: event.password,
},
ClientId: '1q2aum3ptjv1hpb4u3spldal8r',
}).promise();

// Generate access token
const accessToken = cognitoResponse.AuthenticationResult.AccessToken;
//const accessToken = cognitoResponse.AuthenticationResult.AccessToken;
const { AccessToken, RefreshToken } = cognitoResponse.AuthenticationResult

// Include the access token in the response
return {
statusCode: 200,
body: JSON.stringify({ accessToken }),
body: {
accessToken: AccessToken,
refreshToken: RefreshToken
}
};
}

0 comments on commit 11d8310

Please sign in to comment.