Tuesday 15 February 2011

ruby on rails 3 - Overriding default scope set in omniauth gem -


I'm trying to override a default scope set up in an omniauth gem. I have tried to set the scope through the initiator and try to free up the scope. I want to be able to do this

  / auth /   

As a link to sign in.

However, how do I set up a provider in

  config / initializers / omniauth. Rb   

ex:

  Rails.application.config.middleware.use OmniAuth :: Builder Provider: & lt; Provider & gt ;, & lt; App_uid & gt; , & Lt; App_secret & gt;,: scope = & gt; "",: Client_options = & gt; {: Site = & gt; "Https: //api.< provider_url>" ,: authorize_url = & gt; "Https: //api.< provider_url" / oauth / authorize ",: token_url = & gt; "Https: //api.< provider_url">   

It still tries to send omniauth / oauth-2 requests using default scope setup

  omniauth- & lt; Provider & gt; Mani   

How can I pass the default scope declared in Mani through the scope of the URL given to the property?

I was using the following initializer to do this.

  Rails.application.config.middleware.use OmniAuth :: Builder: & lt; Provider & gt ;, & lt; App_uid & gt ;, & lt; App_secret & gt;,: setup = & gt; Lambda {| Env | Env ["omniauth.strategy"]. Option [: scope] = env ["rack.session"] ["omniauth.params"] ["scope"]} ,: client_options = & gt; {: Site = & gt; "Https: //api.< provider_url>" ,: authorize_url = & gt; "Https: //api.< provider_url" / oauth / authorize ",: token_url = & gt; "Https: //api.< provider_url> / oauth / token"} and    

No comments:

Post a Comment