@adastradev/user-management-sdk
Advanced tools
Comparing version 1.0.2 to 1.0.3-beta.1
import { ICognitoUserPoolLocator } from './ICognitoUserPoolLocator'; | ||
import * as AWS from 'aws-sdk'; | ||
import { CognitoUserSession } from 'amazon-cognito-identity-js'; | ||
@@ -9,6 +10,7 @@ export declare class AuthManager { | ||
private cognitoUserSession; | ||
private iamCredentials; | ||
constructor(locator: ICognitoUserPoolLocator, region: string); | ||
signIn(email: string, password: string, newPassword?: string): Promise<CognitoUserSession>; | ||
refreshCognitoCredentials(): Promise<{}>; | ||
configureIamCredentials(): Promise<{}>; | ||
getIamCredentials(): Promise<AWS.CognitoIdentityCredentials>; | ||
} |
@@ -115,6 +115,6 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var cognitoIdentityCredentials, authenticator_1, that_1; | ||
var authenticator_1, that_1; | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
cognitoIdentityCredentials = AWS.config.credentials; | ||
if (cognitoIdentityCredentials.needsRefresh()) { | ||
if (this.iamCredentials.needsRefresh()) { | ||
authenticator_1 = "cognito-idp." + this.region + ".amazonaws.com/" + this.poolData.UserPoolId; | ||
@@ -132,4 +132,4 @@ that_1 = this; | ||
// tslint:disable-next-line:no-string-literal max-line-length | ||
cognitoIdentityCredentials.params['Logins'][authenticator_1] = newSession.getIdToken().getJwtToken(); | ||
cognitoIdentityCredentials.refresh(function (refreshIamErr) { | ||
_this.iamCredentials.params['Logins'][authenticator_1] = newSession.getIdToken().getJwtToken(); | ||
_this.iamCredentials.refresh(function (refreshIamErr) { | ||
if (refreshIamErr) { | ||
@@ -153,3 +153,3 @@ console.log(refreshIamErr); | ||
}; | ||
AuthManager.prototype.configureIamCredentials = function () { | ||
AuthManager.prototype.getIamCredentials = function () { | ||
return new Promise(function (resolve, reject) { | ||
@@ -160,3 +160,3 @@ return __awaiter(this, void 0, void 0, function () { | ||
authenticator = "cognito-idp." + this.region + ".amazonaws.com/" + this.poolData.UserPoolId; | ||
AWS.config.credentials = new AWS.CognitoIdentityCredentials({ | ||
this.iamCredentials = new AWS.CognitoIdentityCredentials({ | ||
IdentityPoolId: this.poolData.IdentityPoolId, | ||
@@ -167,3 +167,3 @@ Logins: (_a = {}, | ||
}); | ||
resolve(true); | ||
resolve(this.iamCredentials); | ||
return [2 /*return*/]; | ||
@@ -170,0 +170,0 @@ }); |
{ | ||
"name": "@adastradev/user-management-sdk", | ||
"version": "1.0.2", | ||
"version": "1.0.3-beta.1", | ||
"description": "Astra user management SDK for JavaScript in the browser and Node.js", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
513
39655
1