How to use the CognitoIdentityServiceProvider function from aws-sdk

Find comprehensive JavaScript aws-sdk.CognitoIdentityServiceProvider code examples handpicked from public code repositorys.

12
13
14
15
16
17
18
19
20
21
apiGatewayPromise = retriableWrap(new aws.APIGateway({ region: awsRegion })),
s3 = new aws.S3(),
iot = new aws.Iot({ region: awsRegion }),
sns = new aws.SNS({ region: awsRegion }),
events = new aws.CloudWatchEvents({ region: awsRegion }),
cognitoIdentityServiceProvider = new aws.CognitoIdentityServiceProvider({ region: awsRegion }),
destroyRule = function (ruleName) {
        return events.listTargetsByRule({ Rule: ruleName }).promise()
        .then(config => {
                const ids = config.Targets.map(target => target.Id);
fork icon290
star icon0
watch icon3

13
14
15
16
17
18
19
20
21
22
} = require('../../src/business/entities/EntityConstants');
const { CognitoIdentityServiceProvider, DynamoDB } = require('aws-sdk');
const { getUserPoolId, getVersion } = require('../util');
const { search } = require('../../src/persistence/elasticsearch/searchClient');

const cognito = new CognitoIdentityServiceProvider({ region: 'us-east-1' });
const dynamo = new DynamoDB({ region: process.env.REGION });

/**
 * Creates a cognito user
fork icon35
star icon72
watch icon19

38
39
40
41
42
43
44
45
46
  authorizationToken,
  requestContext: { queryString, variables },
} = event;

// use athorizationToken to determine the sub of the caller from cognito
const cognito = new AWS.CognitoIdentityServiceProvider();
const accessToken = authorizationToken.replace(/^Banana\s/, "");
try {
  const userInfo = await cognito.getUser({ AccessToken: accessToken }).promise();
fork icon2
star icon4
watch icon0

+ 2 other calls in file

339
340
341
342
343
344
345
346
347
348
349
        sessionToken: Credentials.SessionToken,
    };
}


async function refreshJWTs(authConfig) {
    const CognitoISP = new aws.CognitoIdentityServiceProvider({ region: authConfig.region });
    try {
        const result = await CognitoISP.initiateAuth({
            AuthFlow: 'REFRESH_TOKEN',
            AuthParameters: {
fork icon2
star icon0
watch icon3

+ 8 other calls in file

10
11
12
13
14
15
16
17
18
19
20
21
22
	AUTH_AMPLIFYIDENTITYBROKERAUTH_USERPOOLID
Amplify Params - DO NOT EDIT */


const AWS = require('aws-sdk');


var cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();


exports.handler = async (event) => {
	if (!(event && event.queryStringParameters)) {
		return {
fork icon0
star icon0
watch icon1

+ 29 other calls in file

19
20
21
22
23
24
25
26
27
28
29
30
31
const qs = require('querystring');


var kmsClient = new AWS.KMS();


var docClient = new AWS.DynamoDB.DocumentClient();
var cognitoSP = new AWS.CognitoIdentityServiceProvider();
var codesTableName = process.env.STORAGE_AMPLIFYIDENTITYBROKERCODESTABLE_NAME;
var appClientID = process.env.AUTH_AMPLIFYIDENTITYBROKERAUTH_APPCLIENTIDWEB;


function base64URLEncode(str) {
fork icon0
star icon0
watch icon1

+ 18 other calls in file

-2
fork icon0
star icon0
watch icon0

+ 2 other calls in file

22
23
24
25
26
27
28
29
30
31
    userPoolId = null,
    identityPoolId = null,
    clientAppId = null;

aws.config.region = region;
var cognitoProvider = new aws.CognitoIdentityServiceProvider(),
    cognitoIdentity = new aws.CognitoIdentity();


async.waterfall([
fork icon0
star icon0
watch icon0

309
310
311
312
313
314
315
316
317
318
319
320
321


  return await handler(event, context)
}


const a_user_signs_up = async (password, name, email) => {
  const cognito = new AWS.CognitoIdentityServiceProvider()


  const userPoolId = process.env.COGNITO_USER_POOL_ID
  const clientId = process.env.WEB_COGNITO_USER_POOL_CLIENT_ID

fork icon0
star icon0
watch icon0

23
24
25
26
27
28
29
30
31
32
以下の Lambda を作成。AWS SDK により Cognito 認証を行い、成功すれば IoT Core に関するポリシーを返す。
環境変数(ClientID)として Cognito のアプリクライアント ID を設定する。

```js
const aws = require('aws-sdk');
const cognito = new aws.CognitoIdentityServiceProvider();

exports.handler = async function (event, context, callback) {
  const originalUserName = event.protocolData.mqtt.username;
  // AWS SDKでMQTTpublishした際、usernameは"ユーザ名?SDK=PythonV2&Version=xx"として渡されるのでユーザ名を抽出
fork icon0
star icon0
watch icon1