Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

OAuth Login Issues Error: /api/auth/google/[object%20Object] is not a valid path. #1290

Closed
ChrisSQL opened this issue Apr 3, 2016 · 7 comments

Comments

@ChrisSQL
Copy link

ChrisSQL commented Apr 3, 2016

Hi

Ive been working on a project for a while and this problem just popped up. Im not sure how far back the problem occured or on what commit.

When someone logs in with Facebook or Google it redirects to the server 404 page and shows

Page not found Error: /api/auth/google/[object%20Object] is not a valid path.

However if i refresh the page the user is logged in.

@iamchriswick
Copy link

I'm experiencing the same issue...

@mrbfrank
Copy link

mrbfrank commented Apr 4, 2016

This issue is related/duplicate of #1284

@thodinh
Copy link

thodinh commented Apr 22, 2016

Refer to users.authentication.server.controller.js >>> exports.oauthCallback

exports.oauthCallback = function (strategy) {
    ...
    return res.redirect(redirectURL || sessionRedirectURL || '/');
    ...
}

I debugged and found that redirectURLreceived is an object {} (it is not actually nullor undefined). So redirectURLwill be return in conditional expression redirectURL || sessionRedirectURL || '/'

My solution for this issue is: check type of redirectURL is string or not

    return res.redirect(typeof redirectURL == 'string' ? redirectURL : sessionRedirectURL || '/');

@abaka82
Copy link

abaka82 commented Aug 24, 2016

thanks @thodinh. Your solution is perfect for this social account issue

@lirantal
Copy link
Member

closed via #1284
@chrismaher can you confirm that this issue is fixed in the master branch?

@lirantal lirantal self-assigned this Aug 27, 2016
mbukosky added a commit to mbukosky/SpotifyUnchained that referenced this issue Sep 1, 2016
@o1lab
Copy link

o1lab commented Sep 13, 2016

Thank you @thodinh

@brianpgerson
Copy link

FYI, this is still return res.redirect(redirectURL || sessionRedirectURL || '/'); on 0.4.2. Updated local code with the fix here and it worked.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants