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

有帮助吗?

解决方案

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

其他提示

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top