Logging in with the Linkedin OAuth api: allows you to request permission authorization

I combined my site with the Linkedin OAuth api to get the basic profile settings, and this is the only way to log in to my site (therefore, the login must go through Linkedin every time). The user must provide permissions at login. But now this happens at every login; I can’t get Linkedin to remember that the user has already granted access (so what I want is that the second time it just redirects back to my site automatically)

I get an access token every time I log in successfully, I save it in the database, but I can’t find a way to use it in a subsequent request (I'm not even sure if I should do this?)

The endpoint that I use to log in is:

"https://api.linkedin.com/uas/oauth/authorize?oauth_token=" . $token

Where $ token is an oauth token

Please tell me how to make subsequent requests without Linkedin asking for permissions.

thanks

+4
source share
2 answers

You can try to use php cookie or SESSION and set the expiration date in the next few years, so every user visits your site, your system will check in the database with the token that is stored on cookie or SESSION, only this method can be used, if you don’t want to redirect the user to a page associated with the site on every visit to your site.

+3
source

Source: https://habr.com/ru/post/1607999/


All Articles