hello.js oauth to linkedin - heroku proxy bug or incorrect app def

2.2k Views Asked by At

Good morning

I'm trying to create a "Login via LinkedIn" button with hello.js. I used this sample: hello.js - linkedin demo. Everything is OK and I can login to the LinkedIn.

Now I'm trying to change value of LINKEDIN_CLIENT_ID in line 25. This constant is defined in client_ids.js and its value is "bixrjszkfk0j". It's the API Key of hello.js LinkedIn app. I need to change it to the API Key of my application on LinkedIn.

When I change the key, I can not login. I can see my app on LinkedIn Prompt: "Test2 would like to access some of your LinkedIn info", but seams that LinkedIn prevent a success login to this app.

As I just changed the API Key, so the problem should be in the definition on my app on LinkedIn, not in the code.

This is an image from the definition of my app on LinkedIn: https://i.stack.imgur.com/20QyH.png

More Info:

With the API Key of hello.js app I see that after login this value is set to the Local Storage of browser (Chrome 28 on Ubuntu 13.04):

{
"sync_service":"linkedin",
"linkedin":{
    "expires_in":5104774,
    "access_token":"AQV_zG8n88HW ... (a long id)",
    "state":"",
    "client_id":"bixrjszkfk0j",
    "network":"linkedin",
    "display":"popup",
    "oauth_proxy":"https://auth-server.herokuapp.com/proxy",
    "scope":["basic"],
    "oauth":{
        "version":2,
        "auth":"https://www.linkedin.com/uas/oauth2/authorization",
        "grant":"https://www.linkedin.com/uas/oauth2/accessToken"
    },
"expires":1392801856.753
}
}

For my API Key I got this result in the Local Storage:

{
"linkedin":{
    "error":{
        "code":"required_credentials",
        "message":"Could not find the credentials for signing this request, ensure that the correct client_id is passed"
    },
    "error_message":"Could not find the credentials for signing this request, ensure that the correct client_id is passed",
    "state":"",
    "client_id":"77j96nqcybx2hg",
    "network":"linkedin",
    "display":"popup",
    "oauth_proxy":"https://auth-server.herokuapp.com/proxy",
    "scope":["basic"],
    "oauth":{
        "version":2,
        "auth":"https://www.linkedin.com/uas/oauth2/authorization",
        "grant":"https://www.linkedin.com/uas/oauth2/accessToken"
    }
}
}

Also I have checked my Apache access.log. In both cases I have GET requests like these:

for hello.js app:

http://myhost.abc/dl/aa/b.html?code=AQT7xj4N22o7hGQhnB2kuBD7pet7CM8YF9IYEckbcTMbxVRxKykxBZdZAUmtuOz9UjHYnqE7t8am4A9aMjLCeu2FBZjL3yEp_SG_ks3qal8TFOoW5Hs&state={"client_id":"bixrjszkfk0j","network":"linkedin","display":"popup","callback":"_hellojs_44aevwkw","state":"","oauth_proxy":"https://auth-server.herokuapp.com/proxy","scope":["basic"],"oauth":{"version":2,"auth":"https://www.linkedin.com/uas/oauth2/authorization","grant":"https://www.linkedin.com/uas/oauth2/accessToken"}}

for my app:

http://myhost.abc/dl/aa/b.html?code=AQROQFhP2BawiylIN1Oz3qNVqodrABXExHOtX_gd_WXhqK7rAoWpR5cbNZBdWpkijh6iKfXiP3lwTodrpADm270H9Uuu5jSk6WOCOV-dB-3YkIyf7i0&state={"client_id":"77j96nqcybx2hg","network":"linkedin","display":"popup","callback":"_hellojs_3l93c9ah","state":"","oauth_proxy":"https://auth-server.herokuapp.com/proxy","scope":["basic"],"oauth":{"version":2,"auth":"https://www.linkedin.com/uas/oauth2/authorization","grant":"https://www.linkedin.com/uas/oauth2/accessToken"}}

Also in the list of Authorized External Applications in my LinkedIn account I can see both of "Test2" and "HelloJS OAuth2". So my conclusion is that my app (Test2) is successfully logged in. Is there a problem in hello.js heroku proxy app? Or I should change something in my app definition?

Thanks

1

There are 1 best solutions below

0
On

Register your app key and secret with https://auth-server.herokuapp.com/ unfortunately client side OAuth1 flows still need a serverside proxy for authentication and authorisation, as they can't keep a secret safe.