Skip to content

Linkedin API call fails after successful login #27

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
VladyslavKurmaz opened this issue Mar 26, 2018 · 0 comments
Open

Linkedin API call fails after successful login #27

VladyslavKurmaz opened this issue Mar 26, 2018 · 0 comments

Comments

@VladyslavKurmaz
Copy link

Issue

Github API rejects simple API call GET /users after successful login
https://developer.github.com/v3/users/#get-a-single-user
API responce

{ error: null,
 body: '{"serviceErrorCode":401,"message":"Empty oauth2 access token","status":401}',
   status: 401,
  message: 'Unauthorized' }

How to reproduce

  • Login using linkedin
  • Call API endpoint /v2/me
app.get('/api', function (req, res){
    oauth.auth('linkedin', req.session, {
      credentials: req.session.credentials
    }).then(function (request_object) {
            return request_object.get('/v2/me', {
            });
        })
        .then(function (r) {
           res.status(200).send('<pre>' + JSON.stringify(r) + '</pre>');
        })
        .fail(function (e) {
            res.status(400).send('An error occured while posting the message');
        });
});

package.json

  "dependencies": {
    "cors": "^2.8.4",
    "express": "^4.16.3",
    "express-session": "^1.15.6",
    "npm": "^5.8.0",
    "oauthio": "^0.3.5",
    "session-file-store": "^1.2.0",
    "to": "^0.2.9",
    "update": "^0.7.4"
  },
  "devDependencies": {
    "nodemon": "^1.17.2"
  }

request_object

  { oauth_token: 'xxxxxxxxxxxxxxxxx',
    oauth_token_secret: 'xxxxxxxxxxxxxx',
     request: { url: 'https://api.linkedin.com' },
     state: 'xxxxxxxxxxxxx',
    provider: 'linkedin',
   refreshed: false,
    get: [Function],
   post: [Function],
    patch: [Function],
   put: [Function],
    del: [Function],
   me: [Function],
    getCredentials: [Function],
     wasRefreshed: [Function] }
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

1 participant