从asp.net webforms获取oAuth 2.0访问令牌iframe画布应用程序

编程入门 行业动态 更新时间:2024-10-24 02:38:31
本文介绍了从asp webforms获取oAuth 2.0访问令牌iframe画布应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

问题是这样说:

如何获取访问令牌以使用asp webforms 4.0 iframe画布应用程序的图形API调用

我的画布应用程序已配置为启用OAuth 2.0 for Canvas(测试版)等。

My canvas application has been configured to enable the OAuth 2.0 for Canvas (beta) among other things.

这意味着我正在我的iframe上获得 signed_request 参数。

This means I am getting the signed_request parameter on my iframe which I am successfully reading.

从关于画布验证的表面文档

signed_request参数是HMAC SHA-256签名字符串,句点(。)和base64url编码的JSON对象的级联。

The signed_request parameter is the concatenation of a HMAC SHA-256 signature string, a period (.), and a base64url encoded JSON object.

文档中有一个php代码解码了 signed_request ,但我还没有实现它在C#部分beacuse实际上我不喜欢不重新轮到,而是使用已经测试过的其他代码。

There is a php code in the documentation which decodes the signed_request but I haven't been able to implement it propertly in C# partly beacuse to be honest I prefer not to reinvet the wheel but to use someone else code that has been already tested.

这是我的任务一个很好的C#Facebook SDK再次开始(因为Facebook每隔几个月更改一切图书馆通常已经过时)。

This is where my quest for a good C# Facebook SDK started again (since facebook changes everything every few months librarys get usually obsolete).

我使用了codeplex的 Facebook开发者工具包,但似乎已经过时了,最新的稳定版本是非常老的(在Facebook API时间)

I have used the codeplex's Facebook Developer Toolkit in the past but it seems to be getting outdated ans the lastest stable release is very old (in facebook API time)

几个月前,使用 Oficial Facebook C#SDK GitHub,但它缺乏完整的身份验证支持。

Some months ago used the Oficial Facebook C# SDK from GitHub but it lacks completly the authentication support.

现在我在Nuget上找到了,真的很喜欢从 Nathan Totten 谁是在Facebook专家在StackOverflow。

Now I have found on Nuget and really liked the Facebook C# SDK from Nathan Totten who is one of the top Facebook Experts here in StackOverflow.

如果你Nathan读这个(或任何人也使用这个sdk ),我如何使用这个SDK来获取在我的画布应用程序中使用的访问令牌。

If you Nathan read this (or anyone that also uses this sdk), how can I use this SDK to get an access token to use in my canvas app.

无论如何有一个更好的方法来获取一个令牌,也许与Javascript图书馆请让我(和那些想和我一样的人)知道。

Anyway if there is a better way to get a token, maybe with the Javascript library please let me ( and the people who wonder the same as me ) know.

推荐答案

嘿,卡洛斯。所以要获得访问令牌,您只需在用户验证后执行以下操作:

Hey, Carlos. So to get the access token, you just need to do the following after the user has authenticated:

FacebookApp app = new FacebookApp(); var accessToken = app.Session.AccessToken;

另请参阅我对这个问题的回答: facebook-C#-sdk MVCHello World应用程序 - 如何获取访问令牌?

Also, see my answer to this question: facebook-C#-sdk MVC "Hello World" app - how to get access token?

希望有帮助,否则让我知道如果您有任何其他问题。

Hopefully that helps, otherwise let me know if you have any other questions.

更多推荐

从asp.net webforms获取oAuth 2.0访问令牌iframe画布应用程序

本文发布于:2023-11-14 09:15:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1586817.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:令牌   画布   应用程序   webforms   net

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!