开发者

Facebook auth token and asp.net mvc

开发者 https://www.devze.com 2023-01-19 00:15 出处:网络
We have an ASP.Net MVC site that needs to authenticate to facebook to post photos to a user account.All fine so far.

We have an ASP.Net MVC site that needs to authenticate to facebook to post photos to a user account. All fine so far.

Facebook redirect back to the mvc site. Again fine.

The url that fac开发者_运维问答ebook replies with include the access_token BUT this is prefixed with a # char and MVC strips this and the token from the url so the controller and action get nothing useful.

This is using the user agent type of authentication. If we use the standard auth then it works fine but this doesnt give enough access rights.

Anyone got any clues ??

Thanks


There's no way to read the hash part of an URL (everything that follows the # sign) on the server side because this part is never sent to the server. The only way to access it is on the client side, so you might need to read it using javascript and then send it to the server again using for example AJAX or setting it as a value of a hidden field that is part of a form that you submit to the server.

0

精彩评论

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

关注公众号