Skip to content

Commit

Permalink
Fix UserSession token duration for oauth (#841)
Browse files Browse the repository at this point in the history
* fix(840): fixes a bug where token duration was not honored in oauth flow due to improper \`duration\`

AFFECTS PACKAGES:
@esri/arcgis-rest-auth

ISSUES CLOSED: #840

* removing an unintentional formatting fix in previous commit

* updated UserSession.test.ts
  • Loading branch information
hogpilot authored May 17, 2021
1 parent e59e499 commit 3f43679
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/arcgis-rest-auth/src/UserSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ export class UserSession implements IAuthenticationManager {
};

response.writeHead(301, {
Location: `${portal}/oauth2/authorize?client_id=${clientId}&duration=${duration}&response_type=code&redirect_uri=${encodeURIComponent(
Location: `${portal}/oauth2/authorize?client_id=${clientId}&expiration=${duration}&response_type=code&redirect_uri=${encodeURIComponent(
redirectUri
)}`,
});
Expand Down
2 changes: 1 addition & 1 deletion packages/arcgis-rest-auth/test/UserSession.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,7 @@ describe("UserSession", () => {
end() {
expect(spy.calls.mostRecent().args[0]).toBe(301);
expect(spy.calls.mostRecent().args[1].Location).toBe(
"https://arcgis.com/sharing/rest/oauth2/authorize?client_id=clientId&duration=20160&response_type=code&redirect_uri=https%3A%2F%2Fexample-app.com%2Fredirect-uri"
"https://arcgis.com/sharing/rest/oauth2/authorize?client_id=clientId&expiration=20160&response_type=code&redirect_uri=https%3A%2F%2Fexample-app.com%2Fredirect-uri"
);
done();
},
Expand Down

0 comments on commit 3f43679

Please sign in to comment.