Question

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

Était-ce utile?

La solution

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

Autres conseils

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top