decioferreira/omniauth-linkedin-oauth2 — pull request #5 by amine-bouassida (2013-09-06 08:03:19+00:00)
Title: Add state parameter to authorize_url

Hi and thank you for this great gem,

I tried to use your gem in a project to perfom a linkedin connect but it always redirects me to linkedin.com with an Invalid Request error when I perform a GET of /auth/linkedin.
So, I looked into your gem to see what was done and I found out that in the API documentation (https://developer.linkedin.com/documents/authentication) there is a parameter called state that is required to the authentication process and that is not passed by the gem.
This parameter is required because it's used to prevent CSRF.
So, I just added to the gem this parameter in the autorize_url with a random string as a value and it works fine now.

I think that it's worth adding to your current version because it's simply not working without that.