Skip to content

Commit

Permalink
Merge pull request #166 from Esri/fix-165
Browse files Browse the repository at this point in the history
fix(auth): decode username when parsing response from OAuth
  • Loading branch information
jgravois authored Mar 30, 2018
2 parents 29e879d + e0c2a44 commit fd9005f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 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 @@ -376,7 +376,7 @@ export class UserSession implements IAuthenticationManager {
const expires = new Date(
Date.now() + parseInt(match[2], 10) * 1000 - 60 * 1000
);
const username = match[3];
const username = decodeURIComponent(match[3]);

return completeSignIn(null, {
token,
Expand Down
6 changes: 3 additions & 3 deletions packages/arcgis-rest-auth/test/UserSession.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ describe("UserSession", () => {
const MockWindow = {
location: {
href:
"https://example-app.com/redirect-uri#access_token=token&expires_in=1209600&username=c@sey&persist=true"
"https://example-app.com/redirect-uri#access_token=token&expires_in=1209600&username=c%40sey&persist=true"
},
get parent() {
return this;
Expand Down Expand Up @@ -527,7 +527,7 @@ describe("UserSession", () => {
},
location: {
href:
"https://example-app.com/redirect-uri#access_token=token&expires_in=1209600&username=c@sey"
"https://example-app.com/redirect-uri#access_token=token&expires_in=1209600&username=c%40sey"
}
};

Expand Down Expand Up @@ -557,7 +557,7 @@ describe("UserSession", () => {
},
location: {
href:
"https://example-app.com/redirect-uri#access_token=token&expires_in=1209600&username=c@sey"
"https://example-app.com/redirect-uri#access_token=token&expires_in=1209600&username=c%40sey"
}
};

Expand Down

0 comments on commit fd9005f

Please sign in to comment.