简体   繁体   中英

Parsing Ruby on Rails Parameters (with a # instead of a ?)

I have an application that I am building and the user eveuntually gets redirected to a url on my application like this www.myapp.com/path/#access_token=lkjh8usoij93. How can I parse the access token using ruby on rails? It does not show up as a supplied parameter.

You can't get anchors with Rails (on server side). You can get it only with javascript window.location.href

Use JavaScript to get access_token.

if (window.location.hash) {
    access_token = window.location.hash.replace('#','');
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM