当前位置: 首页>>代码示例>>C#>>正文


C# ParseUser.LinkWithAsync方法代码示例

本文整理汇总了C#中Parse.ParseUser.LinkWithAsync方法的典型用法代码示例。如果您正苦于以下问题:C# ParseUser.LinkWithAsync方法的具体用法?C# ParseUser.LinkWithAsync怎么用?C# ParseUser.LinkWithAsync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Parse.ParseUser的用法示例。


在下文中一共展示了ParseUser.LinkWithAsync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LinkAsync

 /// <summary>
 /// Links a <see cref="ParseUser" /> to a Facebook account, allowing you to use Facebook
 /// for authentication, and providing access to Facebook data for the user.
 /// 
 /// The user will be logged in through Facebook's OAuth web flow, so you must supply a
 /// <paramref name="webView"/> that will be navigated to Facebook's authentication pages.
 /// </summary>
 /// <param name="user">The user to link with Facebook.</param>
 /// <param name="webView">A web view that will be used to present the authorization pages
 /// to the user.</param>
 /// <param name="permissions">A list of Facebook permissions to request.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 public static async Task LinkAsync(ParseUser user,
     WebBrowser webView,
     IEnumerable<string> permissions,
     CancellationToken cancellationToken) {
   authProvider.Permissions = permissions;
   LoadCompletedEventHandler loadCompleted = (_, e) => authProvider.HandleNavigation(e.Uri);
   webView.LoadCompleted += loadCompleted;
   Action<Uri> navigate = uri => webView.Navigate(uri);
   authProvider.Navigate += navigate;
   await user.LinkWithAsync("facebook", cancellationToken);
   authProvider.Navigate -= navigate;
   webView.LoadCompleted -= loadCompleted;
 }
开发者ID:cnbcyln,项目名称:Parse-SDK-dotNET,代码行数:25,代码来源:ParseFacebookUtils.NetFx45.cs

示例2: LinkAsync

 /// <summary>
 /// Links a <see cref="ParseUser" /> to a Facebook account, allowing you to use Facebook
 /// for authentication, and providing access to Facebook data for the user.
 /// 
 /// The user will be logged in through Facebook's OAuth web flow using the Windows
 /// WebAuthenticationBroker.
 /// </summary>
 /// <param name="user">The user to link with Facebook.</param>
 /// <param name="permissions">A list of Facebook permissions to request.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 public static async Task LinkAsync(ParseUser user,
     IEnumerable<string> permissions,
     CancellationToken cancellationToken) {
   var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
   authProvider.Permissions = permissions;
   Action<Uri> navigate = async uri => {
     var result = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None,
         uri,
         FacebookAuthenticationProvider.ResponseUrl);
     if (result.ResponseStatus != WebAuthenticationStatus.Success) {
       cts.Cancel();
     } else {
       authProvider.HandleNavigation(new Uri(result.ResponseData));
     }
   };
   authProvider.Navigate += navigate;
   try {
     await user.LinkWithAsync("facebook", cts.Token);
   } finally {
     authProvider.Navigate -= navigate;
   }
 }
开发者ID:mehul9595,项目名称:Parse-SDK-dotNET,代码行数:32,代码来源:ParseFacebookUtils.WinRT.cs

示例3: LinkAsync

 /// <summary>
 /// Links a <see cref="ParseUser" /> to a Facebook account, allowing you to use Facebook
 /// for authentication, and providing access to Facebook data for the user.
 /// </summary>
 /// <param name="user">The user to link to a Facebook account.</param>
 /// <param name="facebookId">The user's Facebook ID.</param>
 /// <param name="accessToken">A valid access token for the user.</param>
 /// <param name="expiration">The expiration date of the access token.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 public static Task LinkAsync(ParseUser user,
     string facebookId,
     string accessToken,
     DateTime expiration,
     CancellationToken cancellationToken) {
   return user.LinkWithAsync("facebook",
       authProvider.GetAuthData(facebookId, accessToken, expiration),
       cancellationToken);
 }
开发者ID:mehul9595,项目名称:Parse-SDK-dotNET,代码行数:18,代码来源:ParseFacebookUtils.cs


注:本文中的Parse.ParseUser.LinkWithAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。