在ASP.NET MVC中存储Facebook访问令牌的位置? [英] Where to store Facebook access token in ASP.NET MVC?

查看:132
本文介绍了在ASP.NET MVC中存储Facebook访问令牌的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的ASP.NET MVC应用程序中,当我通过OAuthWebSecurity验证用户时,Facebook发回一个包含访问令牌的ExtraData。最初我想把它存储在数据库中,但是在FB文档中说:

In my ASP.NET MVC app, when I authenticate the user with OAuthWebSecurity, Facebook sends back an ExtraData which contains the access token. Initially I thought of storing this in the database, but it says in the FB docs:


你还应该删除存储的访问令牌。 / p>

You should also remove the stored access token.

...当用户登录时。

...when logging the user out.

所以令牌应该作为会话变量来处理,但是在ASP.NET MVC中,我没有会话变量(或者有方法,但不是很好模式)。存储FB用户访问令牌的会话持续时间的最佳方法是什么?

So the token should be handled as a session variable, but in ASP.NET MVC I don't have session variables (or there are ways, but it's not a good pattern). What is the best way to store the FB user acess token for the session duration?

谢谢

推荐答案

使用会话有什么问题,什么意思是没有会话和有办法? Controller具有Session属性。应该易于存储&在那里检索您的令牌。

What's wrong with using the session, and what do you mean by not having a session and "there are ways"? Controller has a Session property. Should be easy to store & retrieve your token in there.

这篇关于在ASP.NET MVC中存储Facebook访问令牌的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆