Skip to content

Optionally avoid parsing callbackURL #18

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/passport-oauth/strategies/oauth2.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,14 @@ OAuth2Strategy.prototype.authenticate = function(req, options) {
// query parameters, and should be propagated to the application.
return this.fail();
}


// Not all callbackURLs should be parsed. For example, certain Google+ OAuth flows
// make use of a callbackURL of "postmessage." This should not be considered a relative URL,
// but simple a string token. To avoid parsing a callbackURL, specify parseCallbackURL: false
// in the options config object that's used to authenticate
var callbackURL = options.callbackURL || this._callbackURL;
if (callbackURL) {
var parseCallbackURL = (options.parseCallbackURL === undefined) || options.parseCallbackURL;
if (callbackURL && parseCallbackURL) {
var parsed = url.parse(callbackURL);
if (!parsed.protocol) {
// The callback URL is relative, resolve a fully qualified URL from the
Expand Down