Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWSPinpointProvider - ensure credentials error : "cannot get guest credentials when mandatory signin enabled" #1273

Closed
safeimuslim opened this issue Jul 19, 2018 · 5 comments
Labels
API Related to REST API issues pending-close-response-required A response is required for this issue to remain open, it will be closed within the next 7 days.

Comments

@safeimuslim
Copy link

When i call API Gateway error like this, how to solve ?

AWSPinpointProvider - ensure credentials error : "cannot get guest credentials when mandatory signin enabled"

@elorzafe
Copy link
Contributor

That shouldn't be an issue with API Gateway necessarily. Do you see errors if you look on network requests?

@elorzafe elorzafe added the API Related to REST API issues label Jul 31, 2018
@mordka
Copy link
Contributor

mordka commented Aug 1, 2018

@elorzafe I'm having the same error when trying to send event to Pinpoint

 [DEBUG] 01:28.672 Credentials - picking up credentials
[DEBUG] 01:28.673 Credentials - getting new cred promise
 [DEBUG] 01:28.674 Credentials - checking if credentials exists and not expired
 [DEBUG] 01:28.676 Credentials - need to get a new credential or refresh the existing one
 {[DEBUG] 01:28.682 AWSPinpointProvider - ensure credentials error: "No Auth module registered in Amplify"}

I'm using amazon-cognito-identity-js separately (it was implemented before Amplify was developed). The user is logged in and credentials are available in AWS.config.credentials

EDIT:
It's a multi-layered issue.

  1. I ensured there is one aws-sdk imported because aws-amplify provides it as a dependency so I changed all the imports from
    import * as AWS from "aws-sdk"; to import * as AWS from "@aws-amplify/core/node_modules/aws-sdk";
  2. I noticed a possible bug in line
    if (AWS.config && AWS.config.credentials && AWS.config.credentials instanceof Credentials) {

    I had to scope AWS.Credentials so the line should look like:
    if (AWS.config && AWS.config.credentials && AWS.config.credentials instanceof AWS.Credentials) {

This is needed to pick up credentials obtained in manual Cognito auth.

  1. Import @aws-amplify/auth and configure it using the same details as used in manual Cognito set up.

After these steps it all works but I still need @aws-amplify/core fixed to allow picking up existing credentials.

@jordanranz
Copy link
Contributor

@safeimuslim,

Are you still experiencing this issue?

@jordanranz jordanranz added the pending-close-response-required A response is required for this issue to remain open, it will be closed within the next 7 days. label Mar 13, 2019
@elorzafe
Copy link
Contributor

elorzafe commented Apr 3, 2019

closing this issue because of inactivity, feel free to create a new issue if the problem persist

@github-actions
Copy link

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API Related to REST API issues pending-close-response-required A response is required for this issue to remain open, it will be closed within the next 7 days.
Projects
None yet
Development

No branches or pull requests

4 participants