Pregunta

So I'm using a Venmo authentication in my Rails site. Basically the user clicks the authenticate button, and is sent to Venmo to authorize my app. Then when authorized, Venmo redirects back to my app but with the url in the format: localhost:3000/dashboard?access_token=accesstokenhere

I need to parse this URL for the 'accesstokenhere' part to then make calls to the Venmo API. What's the easiest way to parse a URL here for the access token?

For more explanation of how this works, here's the Venmo API quickstart guide

¿Fue útil?

Solución

You should have access to the token as params[:access_token] in the Rails controller that handles the callback.

Documentation: http://guides.rubyonrails.org/action_controller_overview.html#parameters

Otros consejos

Rails controllers have access to URL parameters via the params hash. You can get the token with params[:access_token].

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top