Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@esri/arcgis-rest-auth

Package Overview
Dependencies
Maintainers
16
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@esri/arcgis-rest-auth - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

3

dist/esm/authenticated-request-options.d.ts

@@ -14,3 +14,6 @@ import { ApplicationSession } from "./ApplicationSession";

export interface IUserRequestOptions extends IRequestOptions {
/**
* A session representing a logged in user.
*/
authentication: UserSession;
}

@@ -28,3 +28,3 @@ /// <reference types="node" />

/**
* Determines wether to open the authorization window in a new tab/window or in the current window.
* Determines whether to open the authorization window in a new tab/window or in the current window.
*

@@ -40,2 +40,14 @@ * @browserOnly

refreshTokenTTL?: number;
/**
* The locale assumed to render the login page.
*
* @browserOnly
*/
locale?: string;
/**
* Applications can specify an opaque value for this parameter to correlate the authorization request sent with the received response. By default, clientId is used.
*
* @browserOnly
*/
state?: string;
}

@@ -42,0 +54,0 @@ /**

26

dist/esm/UserSession.js

@@ -88,11 +88,13 @@ /* Copyright (c) 2017 Environmental Systems Research Institute, Inc.

*/
UserSession.beginOAuth2 = function (options,
/* istanbul ignore next */ win) {
/* istanbul ignore next */ if (win === void 0) { win = window; }
/* istanbul ignore next */
UserSession.beginOAuth2 = function (options, win) {
if (win === void 0) { win = window; }
var _a = tslib_1.__assign({
portal: "https://arcgis.com/sharing/rest",
duration: 20160,
popup: true
}, options), portal = _a.portal, clientId = _a.clientId, duration = _a.duration, redirectUri = _a.redirectUri, popup = _a.popup;
var url = portal + "/oauth2/authorize?client_id=" + clientId + "&response_type=token&expiration=" + duration + "&redirect_uri=" + encodeURIComponent(redirectUri);
popup: true,
state: options.clientId,
locale: ""
}, options), portal = _a.portal, clientId = _a.clientId, duration = _a.duration, redirectUri = _a.redirectUri, popup = _a.popup, state = _a.state, locale = _a.locale;
var url = portal + "/oauth2/authorize?client_id=" + clientId + "&response_type=token&expiration=" + duration + "&redirect_uri=" + encodeURIComponent(redirectUri) + "&state=" + state + "&locale=" + locale;
if (!popup) {

@@ -126,5 +128,5 @@ win.location.href = url;

*/
UserSession.completeOAuth2 = function (options,
/* istanbul ignore next*/ win) {
/* istanbul ignore next*/ if (win === void 0) { win = window; }
/* istanbul ignore next */
UserSession.completeOAuth2 = function (options, win) {
if (win === void 0) { win = window; }
var _a = tslib_1.__assign({ portal: "https://arcgis.com/sharing/rest" }, options), portal = _a.portal, clientId = _a.clientId;

@@ -162,3 +164,3 @@ function completeSignIn(error, oauthInfo) {

var expires = new Date(Date.now() + parseInt(match[2], 10) * 1000 - 60 * 1000);
var username = match[3];
var username = decodeURIComponent(match[3]);
return completeSignIn(null, {

@@ -238,4 +240,4 @@ token: token,

UserSession.prototype.getToken = function (url) {
if (this.portal === "https://www.arcgis.com/sharing/rest" &&
/^https?:\/\/\S+\.arcgis\.com.+/.test(url)) {
if ((/^https?:\/\/www\.arcgis\.com\/sharing\/rest\/?/.test(this.portal),
/^https?:\/\/\S+\.arcgis\.com.+/.test(url))) {
return this.getFreshToken();

@@ -242,0 +244,0 @@ }

@@ -90,11 +90,13 @@ "use strict";

*/
UserSession.beginOAuth2 = function (options,
/* istanbul ignore next */ win) {
/* istanbul ignore next */ if (win === void 0) { win = window; }
/* istanbul ignore next */
UserSession.beginOAuth2 = function (options, win) {
if (win === void 0) { win = window; }
var _a = tslib_1.__assign({
portal: "https://arcgis.com/sharing/rest",
duration: 20160,
popup: true
}, options), portal = _a.portal, clientId = _a.clientId, duration = _a.duration, redirectUri = _a.redirectUri, popup = _a.popup;
var url = portal + "/oauth2/authorize?client_id=" + clientId + "&response_type=token&expiration=" + duration + "&redirect_uri=" + encodeURIComponent(redirectUri);
popup: true,
state: options.clientId,
locale: ""
}, options), portal = _a.portal, clientId = _a.clientId, duration = _a.duration, redirectUri = _a.redirectUri, popup = _a.popup, state = _a.state, locale = _a.locale;
var url = portal + "/oauth2/authorize?client_id=" + clientId + "&response_type=token&expiration=" + duration + "&redirect_uri=" + encodeURIComponent(redirectUri) + "&state=" + state + "&locale=" + locale;
if (!popup) {

@@ -128,5 +130,5 @@ win.location.href = url;

*/
UserSession.completeOAuth2 = function (options,
/* istanbul ignore next*/ win) {
/* istanbul ignore next*/ if (win === void 0) { win = window; }
/* istanbul ignore next */
UserSession.completeOAuth2 = function (options, win) {
if (win === void 0) { win = window; }
var _a = tslib_1.__assign({ portal: "https://arcgis.com/sharing/rest" }, options), portal = _a.portal, clientId = _a.clientId;

@@ -164,3 +166,3 @@ function completeSignIn(error, oauthInfo) {

var expires = new Date(Date.now() + parseInt(match[2], 10) * 1000 - 60 * 1000);
var username = match[3];
var username = decodeURIComponent(match[3]);
return completeSignIn(null, {

@@ -240,4 +242,4 @@ token: token,

UserSession.prototype.getToken = function (url) {
if (this.portal === "https://www.arcgis.com/sharing/rest" &&
/^https?:\/\/\S+\.arcgis\.com.+/.test(url)) {
if ((/^https?:\/\/www\.arcgis\.com\/sharing\/rest\/?/.test(this.portal),
/^https?:\/\/\S+\.arcgis\.com.+/.test(url))) {
return this.getFreshToken();

@@ -244,0 +246,0 @@ }

@@ -1,2 +0,2 @@

/* @esri/arcgis-rest-auth - v1.1.1 - Mon Mar 05 2018 10:57:35 GMT-0800 (PST)
/* @esri/arcgis-rest-auth - v1.1.2 - Wed May 02 2018 13:58:27 GMT-0700 (PDT)
* Copyright (c) 2018 Environmental Systems Research Institute, Inc.

@@ -193,11 +193,13 @@ * Apache-2.0 */

*/
UserSession.beginOAuth2 = function (options,
/* istanbul ignore next */ win) {
/* istanbul ignore next */ if (win === void 0) { win = window; }
/* istanbul ignore next */
UserSession.beginOAuth2 = function (options, win) {
if (win === void 0) { win = window; }
var _a = __assign({
portal: "https://arcgis.com/sharing/rest",
duration: 20160,
popup: true
}, options), portal = _a.portal, clientId = _a.clientId, duration = _a.duration, redirectUri = _a.redirectUri, popup = _a.popup;
var url = portal + "/oauth2/authorize?client_id=" + clientId + "&response_type=token&expiration=" + duration + "&redirect_uri=" + encodeURIComponent(redirectUri);
popup: true,
state: options.clientId,
locale: ""
}, options), portal = _a.portal, clientId = _a.clientId, duration = _a.duration, redirectUri = _a.redirectUri, popup = _a.popup, state = _a.state, locale = _a.locale;
var url = portal + "/oauth2/authorize?client_id=" + clientId + "&response_type=token&expiration=" + duration + "&redirect_uri=" + encodeURIComponent(redirectUri) + "&state=" + state + "&locale=" + locale;
if (!popup) {

@@ -231,5 +233,5 @@ win.location.href = url;

*/
UserSession.completeOAuth2 = function (options,
/* istanbul ignore next*/ win) {
/* istanbul ignore next*/ if (win === void 0) { win = window; }
/* istanbul ignore next */
UserSession.completeOAuth2 = function (options, win) {
if (win === void 0) { win = window; }
var _a = __assign({ portal: "https://arcgis.com/sharing/rest" }, options), portal = _a.portal, clientId = _a.clientId;

@@ -267,3 +269,3 @@ function completeSignIn(error, oauthInfo) {

var expires = new Date(Date.now() + parseInt(match[2], 10) * 1000 - 60 * 1000);
var username = match[3];
var username = decodeURIComponent(match[3]);
return completeSignIn(null, {

@@ -343,4 +345,3 @@ token: token,

UserSession.prototype.getToken = function (url) {
if (this.portal === "https://www.arcgis.com/sharing/rest" &&
/^https?:\/\/\S+\.arcgis\.com.+/.test(url)) {
if ((/^https?:\/\/www\.arcgis\.com\/sharing\/rest\/?/.test(this.portal), /^https?:\/\/\S+\.arcgis\.com.+/.test(url))) {
return this.getFreshToken();

@@ -347,0 +348,0 @@ }

@@ -1,2 +0,2 @@

/* @esri/arcgis-rest-auth - v1.1.1 - Mon Mar 05 2018 10:57:38 GMT-0800 (PST)
/* @esri/arcgis-rest-auth - v1.1.2 - Wed May 02 2018 13:58:30 GMT-0700 (PDT)
* Copyright (c) 2018 Environmental Systems Research Institute, Inc.

@@ -13,3 +13,3 @@ * Apache-2.0 */

/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.
* Apache-2.0 */var s=function(){function e(e){this.clientId=e.clientId,this._refreshToken=e.refreshToken,this._refreshTokenExpires=e.refreshTokenExpires,this.username=e.username,this.password=e.password,this._token=e.token,this._tokenExpires=e.tokenExpires,this.portal=e.portal||"https://www.arcgis.com/sharing/rest",this.tokenDuration=e.tokenDuration||20160,this.redirectUri=e.redirectUri,this.refreshTokenTTL=e.refreshTokenTTL||1440,this.trustedServers={},this._pendingTokenRequests={}}return Object.defineProperty(e.prototype,"token",{get:function(){return this._token},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tokenExpires",{get:function(){return this._tokenExpires},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"refreshToken",{get:function(){return this._refreshToken},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"refreshTokenExpires",{get:function(){return this._refreshTokenExpires},enumerable:!0,configurable:!0}),e.beginOAuth2=function(t,r){void 0===r&&(r=window);var n=o({portal:"https://arcgis.com/sharing/rest",duration:20160,popup:!0},t),i=n.portal,s=n.clientId,h=n.duration,a=n.redirectUri,p=n.popup,u=i+"/oauth2/authorize?client_id="+s+"&response_type=token&expiration="+h+"&redirect_uri="+encodeURIComponent(a);if(p){var c,k=((c={promise:null,resolve:null,reject:null}).promise=new Promise(function(e,t){c.resolve=e,c.reject=t}),c);return r["__ESRI_REST_AUTH_HANDLER_"+s]=function(t,r){t?k.reject(t):k.resolve(new e({clientId:s,portal:i,token:r.token,tokenExpires:r.expires,username:r.username}))},r.open(u,"oauth-window","height=400,width=600,menubar=no,location=yes,resizable=yes,scrollbars=yes,status=yes"),k.promise}r.location.href=u},e.completeOAuth2=function(r,n){void 0===n&&(n=window);var i=o({portal:"https://arcgis.com/sharing/rest"},r),s=i.portal,h=i.clientId;function a(t,r){if(n.opener&&n.opener.parent)return n.opener.parent["__ESRI_REST_AUTH_HANDLER_"+h](t,r),void n.close();if(n!==n.parent)return n.parent["__ESRI_REST_AUTH_HANDLER_"+h](t,r),void n.close();if(t)throw t;return new e({clientId:h,portal:s,token:r.token,tokenExpires:r.expires,username:r.username})}var p=n.location.href.match(/access_token=(.+)&expires_in=(.+)&username=([^&]+)/);if(!p){var u=n.location.href.match(/error=(.+)&error_description=(.+)/),c=u[1],k=decodeURIComponent(u[2]);return a(new t.ArcGISRequestError(k,c),null)}return a(null,{token:p[1],expires:new Date(Date.now()+1e3*parseInt(p[2],10)-6e4),username:p[3]})},e.authorize=function(e,t){var r=o({portal:"https://arcgis.com/sharing/rest",duration:20160},e),n=r.portal,i=r.clientId,s=r.duration,h=r.redirectUri;t.writeHead(301,{Location:n+"/oauth2/authorize?client_id="+i+"&duration="+s+"&response_type=code&redirect_uri="+encodeURIComponent(h)}),t.end()},e.exchangeAuthorizationCode=function(t,n){var i=o({portal:"https://www.arcgis.com/sharing/rest",duration:20160,refreshTokenTTL:1440},t),s=i.portal,h=i.clientId,a=(i.duration,i.redirectUri),p=i.refreshTokenTTL;return r(s+"/oauth2/token",{grant_type:"authorization_code",client_id:h,redirect_uri:a,code:n}).then(function(t){return new e({clientId:h,portal:s,redirectUri:a,refreshToken:t.refreshToken,refreshTokenTTL:p,refreshTokenExpires:new Date(Date.now()+1e3*(p-1)),token:t.token,tokenExpires:t.expires,username:t.username})})},e.deserialize=function(t){var r=JSON.parse(t);return new e({clientId:r.clientId,refreshToken:r.refreshToken,refreshTokenExpires:new Date(r.refreshTokenExpires),username:r.username,password:r.password,token:r.token,tokenExpires:new Date(r.tokenExpires),portal:r.portal,tokenDuration:r.tokenDuration,redirectUri:r.redirectUri,refreshTokenTTL:r.refreshTokenTTL})},e.prototype.getToken=function(e){return"https://www.arcgis.com/sharing/rest"===this.portal&&/^https?:\/\/\S+\.arcgis\.com.+/.test(e)?this.getFreshToken():new RegExp(this.portal).test(e)?this.getFreshToken():this.getTokenForServer(e)},e.prototype.toJSON=function(){return{clientId:this.clientId,refreshToken:this.refreshToken,refreshTokenExpires:this.refreshTokenExpires,username:this.username,password:this.password,token:this.token,tokenExpires:this.tokenExpires,portal:this.portal,tokenDuration:this.tokenDuration,redirectUri:this.redirectUri,refreshTokenTTL:this.refreshTokenTTL}},e.prototype.serialize=function(){return JSON.stringify(this)},e.prototype.refreshSession=function(){return this.username&&this.password?this.refreshWithUsernameAndPassword():this.clientId&&this.refreshToken?this.refreshWithRefreshToken():Promise.reject(new t.ArcGISAuthError("Unable to refresh token."))},e.prototype.getTokenForServer=function(e){var r=this,n=e.split("/rest/services/")[0],o=this.trustedServers[n];return o&&o.expires.getTime()>Date.now()?Promise.resolve(o.token):this._pendingTokenRequests[n]?this._pendingTokenRequests[n]:(this._pendingTokenRequests[n]=t.request(n+"/rest/info").then(function(e){return e.owningSystemUrl}).then(function(n){if(!new RegExp(n).test(r.portal))throw new t.ArcGISAuthError(e+" is not federated with "+r.portal+".","NOT_FEDERATED");return t.request(n+"/sharing/rest/info")}).then(function(e){return e.authInfo.tokenServicesUrl}).then(function(t){return i(t,{token:r.token,serverUrl:e,expiration:r.tokenDuration})}).then(function(e){return r.trustedServers[n]={expires:new Date(e.expires),token:e.token},e.token}),this._pendingTokenRequests[n])},e.prototype.getFreshToken=function(){var e=this;return this.token&&this.tokenExpires&&this.tokenExpires.getTime()>Date.now()?Promise.resolve(this.token):(this._pendingTokenRequests[this.portal]||(this._pendingTokenRequests[this.portal]=this.refreshSession().then(function(t){return e._pendingTokenRequests[e.portal]=null,t.token})),this._pendingTokenRequests[this.portal])},e.prototype.refreshWithUsernameAndPassword=function(){var e=this;return i(this.portal+"/generateToken",{username:this.username,password:this.password,expiration:this.tokenDuration}).then(function(t){return e._token=t.token,e._tokenExpires=new Date(t.expires),e})},e.prototype.refreshWithRefreshToken=function(){var e=this;return this.refreshToken&&this.refreshTokenExpires&&this.refreshTokenExpires.getTime()<Date.now()?this.refreshRefreshToken():r(this.portal+"/oauth2/token",{client_id:this.clientId,refresh_token:this.refreshToken,grant_type:"refresh_token"}).then(function(t){return e._token=t.token,e._tokenExpires=t.expires,e})},e.prototype.refreshRefreshToken=function(){var e=this;return r(this.portal+"/oauth2/token",{client_id:this.clientId,refresh_token:this.refreshToken,redirect_uri:this.redirectUri,grant_type:"exchange_refresh_token"}).then(function(t){return e._token=t.token,e._tokenExpires=t.expires,e._refreshToken=t.refreshToken,e._refreshTokenExpires=new Date(Date.now()+60*(e.refreshTokenTTL-1)*1e3),e})},e}();e.ApplicationSession=n,e.UserSession=s,e.fetchToken=r,e.generateToken=i,Object.defineProperty(e,"__esModule",{value:!0})});
* Apache-2.0 */var s=function(){function e(e){this.clientId=e.clientId,this._refreshToken=e.refreshToken,this._refreshTokenExpires=e.refreshTokenExpires,this.username=e.username,this.password=e.password,this._token=e.token,this._tokenExpires=e.tokenExpires,this.portal=e.portal||"https://www.arcgis.com/sharing/rest",this.tokenDuration=e.tokenDuration||20160,this.redirectUri=e.redirectUri,this.refreshTokenTTL=e.refreshTokenTTL||1440,this.trustedServers={},this._pendingTokenRequests={}}return Object.defineProperty(e.prototype,"token",{get:function(){return this._token},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tokenExpires",{get:function(){return this._tokenExpires},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"refreshToken",{get:function(){return this._refreshToken},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"refreshTokenExpires",{get:function(){return this._refreshTokenExpires},enumerable:!0,configurable:!0}),e.beginOAuth2=function(t,r){void 0===r&&(r=window);var n=o({portal:"https://arcgis.com/sharing/rest",duration:20160,popup:!0,state:t.clientId,locale:""},t),i=n.portal,s=n.clientId,h=n.duration,a=n.redirectUri,p=n.popup,u=n.state,c=n.locale,k=i+"/oauth2/authorize?client_id="+s+"&response_type=token&expiration="+h+"&redirect_uri="+encodeURIComponent(a)+"&state="+u+"&locale="+c;if(p){var f,d=((f={promise:null,resolve:null,reject:null}).promise=new Promise(function(e,t){f.resolve=e,f.reject=t}),f);return r["__ESRI_REST_AUTH_HANDLER_"+s]=function(t,r){t?d.reject(t):d.resolve(new e({clientId:s,portal:i,token:r.token,tokenExpires:r.expires,username:r.username}))},r.open(k,"oauth-window","height=400,width=600,menubar=no,location=yes,resizable=yes,scrollbars=yes,status=yes"),d.promise}r.location.href=k},e.completeOAuth2=function(r,n){void 0===n&&(n=window);var i=o({portal:"https://arcgis.com/sharing/rest"},r),s=i.portal,h=i.clientId;function a(t,r){if(n.opener&&n.opener.parent)return n.opener.parent["__ESRI_REST_AUTH_HANDLER_"+h](t,r),void n.close();if(n!==n.parent)return n.parent["__ESRI_REST_AUTH_HANDLER_"+h](t,r),void n.close();if(t)throw t;return new e({clientId:h,portal:s,token:r.token,tokenExpires:r.expires,username:r.username})}var p=n.location.href.match(/access_token=(.+)&expires_in=(.+)&username=([^&]+)/);if(!p){var u=n.location.href.match(/error=(.+)&error_description=(.+)/),c=u[1],k=decodeURIComponent(u[2]);return a(new t.ArcGISRequestError(k,c),null)}return a(null,{token:p[1],expires:new Date(Date.now()+1e3*parseInt(p[2],10)-6e4),username:decodeURIComponent(p[3])})},e.authorize=function(e,t){var r=o({portal:"https://arcgis.com/sharing/rest",duration:20160},e),n=r.portal,i=r.clientId,s=r.duration,h=r.redirectUri;t.writeHead(301,{Location:n+"/oauth2/authorize?client_id="+i+"&duration="+s+"&response_type=code&redirect_uri="+encodeURIComponent(h)}),t.end()},e.exchangeAuthorizationCode=function(t,n){var i=o({portal:"https://www.arcgis.com/sharing/rest",duration:20160,refreshTokenTTL:1440},t),s=i.portal,h=i.clientId,a=(i.duration,i.redirectUri),p=i.refreshTokenTTL;return r(s+"/oauth2/token",{grant_type:"authorization_code",client_id:h,redirect_uri:a,code:n}).then(function(t){return new e({clientId:h,portal:s,redirectUri:a,refreshToken:t.refreshToken,refreshTokenTTL:p,refreshTokenExpires:new Date(Date.now()+1e3*(p-1)),token:t.token,tokenExpires:t.expires,username:t.username})})},e.deserialize=function(t){var r=JSON.parse(t);return new e({clientId:r.clientId,refreshToken:r.refreshToken,refreshTokenExpires:new Date(r.refreshTokenExpires),username:r.username,password:r.password,token:r.token,tokenExpires:new Date(r.tokenExpires),portal:r.portal,tokenDuration:r.tokenDuration,redirectUri:r.redirectUri,refreshTokenTTL:r.refreshTokenTTL})},e.prototype.getToken=function(e){return/^https?:\/\/www\.arcgis\.com\/sharing\/rest\/?/.test(this.portal),/^https?:\/\/\S+\.arcgis\.com.+/.test(e)?this.getFreshToken():new RegExp(this.portal).test(e)?this.getFreshToken():this.getTokenForServer(e)},e.prototype.toJSON=function(){return{clientId:this.clientId,refreshToken:this.refreshToken,refreshTokenExpires:this.refreshTokenExpires,username:this.username,password:this.password,token:this.token,tokenExpires:this.tokenExpires,portal:this.portal,tokenDuration:this.tokenDuration,redirectUri:this.redirectUri,refreshTokenTTL:this.refreshTokenTTL}},e.prototype.serialize=function(){return JSON.stringify(this)},e.prototype.refreshSession=function(){return this.username&&this.password?this.refreshWithUsernameAndPassword():this.clientId&&this.refreshToken?this.refreshWithRefreshToken():Promise.reject(new t.ArcGISAuthError("Unable to refresh token."))},e.prototype.getTokenForServer=function(e){var r=this,n=e.split("/rest/services/")[0],o=this.trustedServers[n];return o&&o.expires.getTime()>Date.now()?Promise.resolve(o.token):this._pendingTokenRequests[n]?this._pendingTokenRequests[n]:(this._pendingTokenRequests[n]=t.request(n+"/rest/info").then(function(e){return e.owningSystemUrl}).then(function(n){if(!new RegExp(n).test(r.portal))throw new t.ArcGISAuthError(e+" is not federated with "+r.portal+".","NOT_FEDERATED");return t.request(n+"/sharing/rest/info")}).then(function(e){return e.authInfo.tokenServicesUrl}).then(function(t){return i(t,{token:r.token,serverUrl:e,expiration:r.tokenDuration})}).then(function(e){return r.trustedServers[n]={expires:new Date(e.expires),token:e.token},e.token}),this._pendingTokenRequests[n])},e.prototype.getFreshToken=function(){var e=this;return this.token&&this.tokenExpires&&this.tokenExpires.getTime()>Date.now()?Promise.resolve(this.token):(this._pendingTokenRequests[this.portal]||(this._pendingTokenRequests[this.portal]=this.refreshSession().then(function(t){return e._pendingTokenRequests[e.portal]=null,t.token})),this._pendingTokenRequests[this.portal])},e.prototype.refreshWithUsernameAndPassword=function(){var e=this;return i(this.portal+"/generateToken",{username:this.username,password:this.password,expiration:this.tokenDuration}).then(function(t){return e._token=t.token,e._tokenExpires=new Date(t.expires),e})},e.prototype.refreshWithRefreshToken=function(){var e=this;return this.refreshToken&&this.refreshTokenExpires&&this.refreshTokenExpires.getTime()<Date.now()?this.refreshRefreshToken():r(this.portal+"/oauth2/token",{client_id:this.clientId,refresh_token:this.refreshToken,grant_type:"refresh_token"}).then(function(t){return e._token=t.token,e._tokenExpires=t.expires,e})},e.prototype.refreshRefreshToken=function(){var e=this;return r(this.portal+"/oauth2/token",{client_id:this.clientId,refresh_token:this.refreshToken,redirect_uri:this.redirectUri,grant_type:"exchange_refresh_token"}).then(function(t){return e._token=t.token,e._tokenExpires=t.expires,e._refreshToken=t.refreshToken,e._refreshTokenExpires=new Date(Date.now()+60*(e.refreshTokenTTL-1)*1e3),e})},e}();e.ApplicationSession=n,e.UserSession=s,e.fetchToken=r,e.generateToken=i,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=arcgis-rest-auth.umd.min.js.map
{
"name": "@esri/arcgis-rest-auth",
"version": "1.1.1",
"version": "1.1.2",
"description": "Authentication helpers for @esri/arcgis-rest-*.",

@@ -21,3 +21,3 @@ "main": "dist/node/index.js",

"devDependencies": {
"@esri/arcgis-rest-request": "^1.1.1"
"@esri/arcgis-rest-request": "^1.1.2"
},

@@ -24,0 +24,0 @@ "scripts": {

@@ -17,2 +17,3 @@ [![npm version][npm-img]][npm-url]

```bash
npm install @esri/arcgis-rest-request
npm install @esri/arcgis-rest-auth

@@ -30,2 +31,4 @@ ```

### [API Reference](https://esri.github.io/arcgis-rest-js/api/auth/)
### Issues

@@ -63,2 +66,2 @@

A copy of the license is available in the repository's [LICENSE](./LICENSE) file.
A copy of the license is available in the repository's [LICENSE](../../LICENSE) file.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc