Skip to content
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

"/auth/linkedin" Does not redirect to linkedin. #15

Closed
collinglass opened this issue Sep 1, 2014 · 7 comments
Closed

"/auth/linkedin" Does not redirect to linkedin. #15

collinglass opened this issue Sep 1, 2014 · 7 comments

Comments

@collinglass
Copy link

My config has linkedin enabled like so:

{
linkedin: {
            enabled: true,
            auth: function(token, tokenSecret, profile, done) {...},
            client_id: "fooooooo",
            client_secret: "ba@@ar",
            scope: ["foo", "bar", "r_fullprofile"]
        }
}

My linkedin account also has the correct port for callback. My same setup was not changed from a working version with express.
After diving into your code, I found a couple differences:

  1. passport-linkedin was not working for me, I used https://github.com/auth0/passport-linkedin-oauth2. It has been updated more recently.
  2. On my route "/auth/linkedin" I had to update it to passport.authenticate( "linkedin", { state: 'some state' } ) ); This is found on Line 443 in your code (however it still didn't work when I changed it.)
  3. Also, in my express code I had to add passReqToCallback: true to my passport options so I could add the token to the session store.

This could very well be my own error, so if it is not an error, and you in fact are able to get redirected, maybe I could be pointed in the right direction.

@avoidwork
Copy link
Owner

I'm just going to guess you where you using 'localhost' which is rewritten to 127.0.0.1, which means your cookie is lost. LinkedIn auth has been stable for 3 minor releases.

@collinglass
Copy link
Author

I had 127.0.0.1 set, I'm sure I was doing something wrong. Any chance on getting a linkedin tutorial out on http://avoidwork.github.io/tenso/tutorials.html anytime soon?

@avoidwork
Copy link
Owner

Yeah, sure... but it'll be pretty basic. You're only filling out the config and not setting the routes right? They're generated for you.

@collinglass
Copy link
Author

I wrote the above in my config (with correct client and scope data) and it didn't redirect, it just waited..

My complete config:

var config = {
    routes: routes,
    hostname: "127.0.0.1",
    port: 1337,
    auth: {
        protect: ["/something"],
        bearer: {
            enabled: true,
            tokens: []
        },
        linkedin: {
            enabled: true,
            auth: function(token, tokenSecret, profile, done) {
                users.linkedin(token, profile).then(function(result) {
                    done(null, result);
                });
            },
            client_id: "...",
            client_secret: "...",
            scope: ['r_network', 'rw_groups', 'r_fullprofile']
        }
    },
    headers: {
    }
}

@avoidwork
Copy link
Owner

I'll test that tonight, but it's practically the same as my tests. I do see you not handling the error case of your promise tsk tsk ;)

@avoidwork avoidwork reopened this Sep 2, 2014
@avoidwork
Copy link
Owner

The combo of bearer + linkedin is not playing nice.

@avoidwork
Copy link
Owner

Bearer auth is currently not tied to an end point, so when you try to access the first step of the linkedin auth, you're already technically unauthorized via the session, hence the message. Bearer & Basic will have to be tied to new /auth end points.

avoidwork added a commit that referenced this issue Sep 3, 2014
…earer` under `/auth`, such that they don't collide with stateful strategies, updated `hypermedia()` to add a `collection` link for non `Array/Object` representations & to set a `rel` of `item` for `Array` based links, updated tests, fixes #15

Reverting a test condition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants