'Session issue with cypress aws-amplify

We are using the AWS Cognito users pool for our signup/sign-in process which is having the app secret key and client id set in the user pool setting on the AWS user pool.

in our codebase, we are using next-auth for Login and creating sessions with Cognito and use info for the user in session, now the next auth needs the client id and secret key for login into AWS, tried sending empty secret key nexauth give error

https://next-auth.js.org/errors#oauth_callback_error invalid_client {

error: { message: 'invalid_client', stack: 'OPError: invalid_client\n' + ' at processResponse (/home/ubuntu/code/node_modules/openid-client/lib/helpers/process_response.js:38:13)\n' + ' at Client.grant (/home/ubuntu/code/node_modules/openid-client/lib/client.js:1338:22)\n' + ' at processTicksAndRejections (internal/process/task_queues.js:95:5)\n' + ' at async Client.callback (/home/ubuntu/code/node_modules/openid-client/lib/client.js:472:24)\n' + ' at async oAuthCallback (/home/ubuntu/code/node_modules/next-auth/core/lib/oauth/callback.js:112:16)\n' + ' at async Object.callback (/home/ubuntu/code/node_modules/next-auth/core/routes/callback.js:50:11)\n' + ' at async NextAuthHandler (/home/ubuntu/code/node_modules/next-auth/core/index.js:133:28)\n' + ' at async NextAuthNextHandler (/home/ubuntu/code/node_modules/next-auth/next/index.js:20:19)\n' + ' at async /home/ubuntu/code/csm-brand-portal-front/next/index.js:56:32\n' + ' at async Object.apiResolver (/home/ubuntu/code/node_modules/next/dist/server/api-utils.js:102:9)', name: 'OPError' }, providerId: 'cognito', message: 'invalid_client' } [next-auth][error][CALLBACK_OAUTH_ERROR]

when we pass the secret key it works fine and does its stuff.

now we are trying to add an e2e test case in cypress for our codebase and capture the scenarios, we are trying to add a test for login and go to the user dashboard. for login into AWS, we are using AWS amplify package in our cypress repo and now the issue with this is it does not support the secret key and API gives an error.

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source