react-linkedin-sdk icon indicating copy to clipboard operation
react-linkedin-sdk copied to clipboard

linkedIn accessToken

Open carloska opened this issue 7 years ago • 6 comments

I want to ask if there is any way to ask for linkedIn access token with help of this component? My login procedure should be in this way:

  1. LinkedIn authentication fired from frontend, where I get an accessToken
  2. The accessToken will be send to backend to login
  3. At the backend side, get informations from linkedIn with accessToken, and resolve login
  4. return the login result to frontend

This procedure is implemented at Facebook login, the same way I want also at LinkedIn

thanks a lot.

carloska avatar Sep 11 '18 13:09 carloska

I will have a look into this and get back to you. I think is possible to do and if it is I will implement into the component 👍

JeffersonFilho avatar Sep 11 '18 14:09 JeffersonFilho

I will have a look into this and get back to you. I think is possible to do and if it is I will implement into the component 👍

I found a possible way: Im getting an access token from window.IN.ENV.auth.oauth_token I put this token into response and send it back to callback, from there send is back to backend, and the LinkedIn rest api worked with access token attached to url as parameter "oauth_token". I dont know if is this a good way, but it`s working, and the token expires after a time.

It would be also a good improvement the ability to define the complete render node instead of the default. For example if I want to use a link instead of a button, or I want to use my component button, with a logo inside, or something else. For example at my facebook component: render={renderProps => ( <IconButton className={classes.iconButton} onClick={renderProps.onClick}><FacebookBoxIcon className={classes.icon} /></IconButton> )}

carloska avatar Sep 13 '18 14:09 carloska

@carloska I recently worked with Linked In sign in feature. I did consider your solution before (send oauth_token from window.IN.ENV.auth.oauth_token to server, and server validate one more time) but it is not documented anywhere, so I can not know they will support it in the future. So I solved this problem by following this link Authenticating with OAuth 2.0. I did wrapped it into a package. If you are still interested, take a look at my repo https://github.com/nvh95/react-linkedin-login-oauth2

nvh95 avatar Sep 22 '18 07:09 nvh95

@carloska Awesome, I like the idea of a custom component! I will see if I implement this option this week with the oauth_token included too.

JeffersonFilho avatar Sep 23 '18 15:09 JeffersonFilho

I am also trying to get the access token. but I get: Cannot read property 'isAuthorized' of undefined seems that handleAuthorization = e => { if (window.IN.User.isAuthorized()) { return window.IN.User.logout(this.callBack, '') } return window.IN.User.authorize(this.callBack, '') } is where this happens

nitucassian avatar Oct 18 '18 15:10 nitucassian

I will have a look to do and let you know what I get.

JeffersonFilho avatar Oct 21 '18 16:10 JeffersonFilho