开发者

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

开发者 https://www.devze.com 2023-02-22 08:21 出处:网络
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 u

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 u开发者_开发知识库p 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('#','');
}
0

精彩评论

暂无评论...
验证码 换一张
取 消