質問

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