Have you looked at OmniAuth yet? That's how I would try to connect to an OAuth provider. There is a Devise strategy for OmniAuth. All the documentation you will find will show you how to connect via Facebook or Twitter or whatnot, but it's the same drill no matter which provider you choose.
Walter
> On Dec 22, 2017, at 3:51 AM, belgoros <s.cambour@gmail.com> wrote:
>
> I have a corporate OAuth 2.0 API that every application should use to authenticate its users. This API requires a request to have the following parameyers:
> • response_type : must be set to "token"
> • client_id : client identifier for the application
> • redirect_uri : URI for the callback
> • state : a random value used by the client to maintain state between the request and callback
> Example:
>
> HTTP GET
> https://corporate.auth.com/authorize?response_type=token&client_id=mySinglePageApp&state=myAppRandomState&redirect_uri=http%3A%2F%2Fmyapp%2Fcallback
>
> If the user is not authenticated, the standard corporate login page is displayed to enter user name and password.
> If the user is authenticated after submitting the his user name and password, he is redirected to the client callback URL with an API generated token:
>
> HTTP 302 Redirect
> Location https://myapp/callback#access_token=2YotnFZFEjr1zCsicMWpAA&type=Bearer&expire_in=3600&state=myAppRandomState
>
>
> What is the way to go to connect a Rails app to this API ? Should I the use the Devise gem for that ? Any other solutions ?
>
> Thank you!
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/42651038-d802-4e1d-bdb6-8b89cf6e8f38%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/5ECC5D35-6EB0-4953-9D78-8920F2445983%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
Are you seeing this in development or production? I would expect this behavior in development, but never in production. In my experience, connection pools are established and maintained for the run-time of the application. Naturally, if you are deployed in an auto-scaling environment, each instance of your app will get its own pool(s), but that's to be expected.
Walter
> On Dec 21, 2017, at 9:11 AM, vaibhav paliwal <vaibhav.paliwal88@gmail.com> wrote:
>
> Hi,
>
> In our rails application we need to establish connection to database based on the client id in the URL. Currently we are using establish_connection but it looks like it creates new connection pool each time and executes some queries to get schema information about DB. Is there a way to cache connection pool ? I am also curious why did Active Record decided not to cache the connection pools based on configuration ? I am not sure if its a great idea to subclass ConnectionHandler and roll my own connection pool caching something like this any opinions ?
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/52905ce6-8bc9-422f-becd-ab8609cfc7f2%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3A748167-EA1F-473B-A0B6-85BCF8748446%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
- response_type : must be set to "token"
- client_id : client identifier for the application
- redirect_uri : URI for the callback
- state : a random value used by the client to maintain state between the request and callback
HTTP GEThttps://corporate.auth.com/authorize?response_type=token&client_id=mySinglePageApp&state=myAppRandomState&redirect_uri=http%3A%2F%2Fmyapp%2FcallbackHTTP 302 RedirectLocation https://myapp/callback#access_token=2YotnFZFEjr1zCsicMWpAA&type=Bearer&expire_in=3600&state=myAppRandomStateYou received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/42651038-d802-4e1d-bdb6-8b89cf6e8f38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.