简体   繁体   中英

using omniauth's linkedin token in linkedin plugin

I am using Rails with omniauth plugin to authenticate my application via LinkedIn. Currently, I store the linkedin token which omniauth returns if the user successfully authorize the application:

oauth_token"=>"9dd623ad-1e21-2cec-9ede-107e1f8e9e18"

I am also using linkedin plugin to get user's Linkedin information. The problem is; the plugin requires two tokens like the following:

client.authorize_from_request(rtoken, rsecret, pin)
c.authorize_from_access("OU812", "8675309")

How can I use the omniauth's token in linkedin plugin? Any idea?

OMNIAUTH is for Authentication only. AFAIK you wont be able to use the API with that oauth token alone. Youll still need to send the user off to linked in to authorize API access by doing something like

client.request_token(:oauth_callback =>'your callback url')

See example here:

http://pivotallabs.com/users/will/blog/articles/1096-linkedin-gem-for-a-web-app

Update:

I was able to reuse access token and access secret that I received upon Omniauth callback from LinkedIn and pass it on to client.authorize_from_access and got access to LinkedIn API that way. Your mileage may vary as I had to customize linked_in gem to fit my workflow a bit, but once Omniauth gets access token and secret you no longer need to call client.authorize_from_request

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM