Marko Anastasov wrote this on August 17, 2011

How to use linkedin gem with Omniauth

Say you want to use the linkedin gem as an interface to the LinkedIn API, but you can’t do what it says in the README, because you want your user to authenticate with Omniauth’s LinkedIn strategy. The solution is to save your user’s access token and secret that you receive in the OAuth callback action, and use them to access the API.

Assuming that a LinkedinConnection model belongs to User, in your controller you might write:

Now whenever you need to make a call to the API, you first need to make a new LinkedIn::Client object using the saved token and secret:

comments powered by Disqus

About Marko Anastasov

Marko co-founded Rendered Text. He’s a programmer with a passion of creating something for other people, coupled with interests in how things work in the society and nature. He is having a great time working across many areas in the company, including product design, helping the engineering teams, empowering users and marketing. He likes to counterbalance it all with running, cycling or a day in the woods.

Suggested Reads

Inject is a fundamental building block

Inject is one of the fundamental, and most versatile constructs available in functional languages. It can be used to implement map, select, max, all? and a bunch of other iteration related methods. Unfortunately, many programmers are not aware of its awesome powers. This article is here to improve this fact.


Rendered Text is a software company. For questions regarding Semaphore, please visit Otherwise, feel free to get in touch any time by sending us an email.

Rendered Text
Svetozara Miletica 10
21000 Novi Sad