-
Notifications
You must be signed in to change notification settings - Fork 493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate current window origin and redirecturi origin to prevent mismatches #615
Conversation
var origin = location.origin; | ||
if (!origin) { | ||
origin = | ||
location.protocol + '//' + location.hostname + (location.port ? ':' + location.port : ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the new line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prettier auto formatting.
@@ -387,7 +388,7 @@ WebAuth.prototype.checkSession = function(options, cb) { | |||
.with(options); | |||
|
|||
if (params.responseType === 'code') { | |||
return cb(new Error("responseType can't be `code`")); | |||
return cb({ error: 'error', error_description: "responseType can't be `code`" }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why has this changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was wrong before. you couldn't catch the error because it was not using the standard error formatting {error, error_description}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok good was wondering that
@@ -11,8 +12,10 @@ function runWebMessageFlow(authorizeUrl, options, callback) { | |||
timeout: options.timeout, | |||
eventValidator: { | |||
isValid: function(eventData) { | |||
return eventData.event.data.type === 'authorization_response' | |||
&& options.state === eventData.event.data.response.state; | |||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also prettier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.