[英]How to authenticate using Twitter in Windows phone 8.1?
I have the following code for Login Authentication via Twitter in my Windows Phone 8.1 application: 我在Windows Phone 8.1应用程序中具有以下用于通过Twitter进行登录身份验证的代码:
user = App.MobileService.LoginAsync(MobileServiceAuthenticationProvider.Twitter);
But in wp8.1 LoginAsync method requires 2 parameters and the second parameter should be: JObject token
where token
is a Provider specific object with existing OAuth token to log in with
但是在wp8.1中,LoginAsync方法需要2个参数,第二个参数应该是:
JObject token
,其中token
是Provider specific object with existing OAuth token to log in with
What should I enter as a second parameter? 我应该输入什么作为第二个参数? An object of JObject class with the Twitter Access Keys?
具有Twitter访问键的JObject类的对象? If so, how do I assign the keys to the object?
如果是这样,如何为对象分配键?
The token object needs to be formatted depending on the specific provider. 令牌对象需要根据特定的提供程序进行格式化。 These are some examples of formats based on the providers:
这些是基于提供程序的一些格式示例:
MicrosoftAccount {"authenticationToken":"<authentication_token>"} Facebook {"access_token":"<access_token>"} Google {"access_token":"<access_token>"} Azure Active Directory {"access_token":"<access_token>"}
I took this information from: https://msdn.microsoft.com/en-us/library/dn296411.aspx 我从以下网址获取了此信息: https : //msdn.microsoft.com/en-us/library/dn296411.aspx
So maybe something like 所以也许像
user = App.MobileService.LoginAsync( MobileServiceAuthenticationProvider.Twitter, "{"access_token":"<access_token>"}");
EDIT: yeah you're right. 编辑:是的,你是对的。 it can't be a string
它不能是字符串
JObject obj = JObject.Parse(@"{"access_token":"<access_token>"}");
user = App.MobileService.LoginAsync( MobileServiceAuthenticationProvider.Twitter, obj);
You can use TwitterAutherino to integrate Sign in with Twitter button 您可以使用TwitterAutherino集成“使用Twitter登录”按钮
I am the author of this library, so let me know if you need some non-existent features or some explanation on tutorials 我是该库的作者,所以如果您需要一些不存在的功能或对教程的一些说明,请告诉我
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.