Skip to content

Commit

Permalink
Merge pull request #2058 from bhollis/authloops
Browse files Browse the repository at this point in the history
Better error handling for weird Bungie.net auth responses (no auth loops)
  • Loading branch information
bhollis committed Aug 4, 2017
2 parents 6f2e63b + ba4eea4 commit 0079eb0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/app/auth-return/return.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,16 @@ function ReturnController($http, OAuthService, OAuthTokenService) {
ctrl.state = queryString.state;
ctrl.authorized = (ctrl.code && ctrl.code.length > 0);

if (!ctrl.authorized || ctrl.state !== localStorage.authorizationState) {
window.location = "/index.html#!/login";
if (!ctrl.authorized) {
ctrl.error = "We expected an authorization code parameter from Bungie.net, but didn't get one.";
return;
}

if (ctrl.state !== localStorage.authorizationState) {
ctrl.error = "We expected the state parameter to match what we stored, but it didn't.";
if (!localStorage.authorizationState) {
ctrl.error += " There was no stored state at all - your browser may not support (or may be blocking) localStorage.";
}
return;
}

Expand Down

0 comments on commit 0079eb0

Please sign in to comment.