获得许可授权 [英] Authorize with Permissions

查看:67
本文介绍了获得许可授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Facebook C#SDK 5.0.8完成了"ASP.NET MVC 3网站入门".一切正常.

I've done the "Getting Started with an ASP.NET MVC 3 Website" using Facebook C# SDK 5.0.8. Everything works fine.

此后,我如何向用户请求额外的权限?

How do I request extra Permissions from the user after that?

当我执行[Authorize(Permissions = "offline_access")]时,得到的"System.Web.Mvc.AuthorizeAttribute"不包含权限"错误的定义.

When I do [Authorize(Permissions = "offline_access")], I get 'System.Web.Mvc.AuthorizeAttribute' does not contain a definition for 'Permissions' error.

如果我使用[FacebookAuthorize(Permissions = "offline_access")],则该页面将重定向到自身,而无需转到Facebook登录页面.

If I use [FacebookAuthorize(Permissions = "offline_access")], the page redirects to itself without going to the facebook login page.

请帮助!

谢谢

推荐答案

因此Authorize属性不是Facebook C#SDK的一部分.该示例向您展示了如何将Facebook授权与Forms授权结合使用. Authorize属性不包含名为权限的属性,也不能用于与Facebook进行授权,它正在使用当前的ASP.NET Membership提供程序检查权限.

So the Authorize attribute is not part of the Facebook C# SDK. That example show you how to use Facebook authorization in conjunction with Forms authorization. The Authorize attribute does not contain a property named permission nor could it be used to authorize with Facebook, it is checking for permissions using your current ASP.NET Membership provider.

关于FacebookAuthorize属性不起作用,这是因为您不能将这两种情况混合在一起.基本上,您阅读的教程向您展示了如何在不使用Javascript SDK等的情况下以最简单的方式进行授权.在该教程中,您不应该在Facebook.Web或Facebook.Web.Mvc中使用任何内容,因为它们并非旨在工作与表单身份验证.

Regarding the FacebookAuthorize attribute not working, that is because you can't mix the two scenarios together. Basically, the tutorial you read shows you how to do authorization in the most simple way without using the Javascript SDK, etc. You should not use anything in Facebook.Web or Facebook.Web.Mvc in that tutorial as they are not designed to work with Forms Authentication.

我建议您看一下其他一些示例. Y他们将帮助您开始一些更常见的情况,例如要求其他权限.

I would suggest taking a look at some of the other samples. YThey will help you get started for some of the more common scenarios like asking for additional permissions.

这篇关于获得许可授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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