User Pools for Amazon Cognito - CredentialsError: Missing credentials in config

前端 未结 2 1683
逝去的感伤
逝去的感伤 2020-12-17 19:25

I am trying to create a Web App Authentication with help of this tutorial. Here is the code I have written -

var app = {};

app.configureCognito = function(         


        
2条回答
  •  太阳男子
    2020-12-17 20:02

    I used AWS amplify to configure AWS sdk and AWS ses. I had the same error but was able to overcome using below solution. I used AWS amplify and React js.

    Hope this helpful for who had issues with amplify and sdk.

    Auth.currentCredentials().then(res => {
    
                AWS.config.update({
                    region: 'ap-southeast-1',
                    credentials: res
                });
    
                AWS.config.getCredentials(function (err) {
                    if (err) console.log(err.stack); // credentials not loaded
                    else console.log("Access Key:", AWS.config.credentials.accessKeyId);
                })
    
    
                var ses = new AWS.SES({
                    region: 'ap-south-1',
                    apiVersion: '2010-12-01'
                });
    
                this.setState({
                    open: false,
                    ses: ses
                });
    
                AWS.config.getCredentials(function (err) {
                    if (err) console.log(err.stack); // credentials not loaded
                    else console.log("Access Key:", AWS.config.credentials.accessKeyId);
                })
    
            })
    

提交回复
热议问题