授权令牌值


Authorization Token Value

如何从该URL获取访问令牌值?

http://4fb.in/skt-seesmic/auth.php#access_token=IkD85bV-iUgflTSd0KNbrs_Z4IApLpgVjA5dDLH9nhf7V-WI

在服务器端,不发送url的哈希参数。

因此,为了处理哈希部分,在上面的文件中,您可以通过javascript发送它:(下面的示例使用jQuery)

$(document).ready(function(){
    var auth=(window.location.hash.split('='))[1];
    $.ajax({
        url:'processing_php_file?token='+auth,
        success:function(response){
            //Processed.
        }
    });
});

$(document).ready(function(){
    var auth=(window.location.hash.split('='))[1];
    window.location='processing_php_file?token='+auth;
});

然后,在处理文件中,可以将该值作为$_GET['token']访问。

在PHP中,您可以使用:parse_url($url, PHP_URL_FRAGMENT);

在javascript中:alert(window.location.hash);