3 examples of 'cognitoidentitycredentials' in JavaScript

Every line of 'cognitoidentitycredentials' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
63static get COGNITO_IDENTITY() {
64 return 'cognito-identity';
65}
167_createCognitoIdentityCredentials(role = null) {
168 let cognitoParams = {
169 IdentityPoolId: this.identityPoolId,
170 };
171
172 if (this.identityProvider) {
173 cognitoParams.Logins = {};
174 cognitoParams.Logins[this.identityProvider.domain] = this.identityProvider.userToken;
175 cognitoParams.LoginId = this.identityProvider.userId;
176
177 if (role) {
178 cognitoParams.RoleArn = role.IamRole.Arn;
179 cognitoParams.RoleSessionName = this.roleSessionKey(role);
180 }
181 }
182
183 let credentials = new AWS.CognitoIdentityCredentials(cognitoParams);
184
185 // do not replace with arrow function, `this` context should not be overwritten
186 credentials.toJSON = function () {
187 return {
188 expired: this.expired,
189 expireTime: this.expireTime,
190 accessKeyId: this.accessKeyId,
191 secretAccessKey: this.secretAccessKey,
192 sessionToken: this.sessionToken,
193 };
194 };
195
196 return credentials;
197}
46function initCredentials() {
47 const logins = {};
48 logins[poolName] = idtoken;
49 if (noauth === 'true') {
50 const credentials = new AWS.CognitoIdentityCredentials({
51 IdentityPoolId: poolId,
52 }, { region });
53 return credentials;
54 } else {
55 const credentials = new AWS.CognitoIdentityCredentials({
56 IdentityPoolId: poolId,
57 Logins: logins,
58 }, { region });
59 return credentials;
60 }
61}

Related snippets