Exemple #1
0
 /// <summary>
 /// 使用第三方数据登录
 /// </summary>
 /// <param name="authData"></param>
 /// <param name="platform"></param>
 /// <param name="option"></param>
 /// <returns></returns>
 public static Task <LCUser> LoginWithAuthData(Dictionary <string, object> authData, string platform,
                                               LCUserAuthDataLoginOption option = null)
 {
     if (authData == null)
     {
         throw new ArgumentNullException(nameof(authData));
     }
     if (string.IsNullOrEmpty(platform))
     {
         throw new ArgumentNullException(nameof(platform));
     }
     if (option == null)
     {
         option = new LCUserAuthDataLoginOption();
     }
     return(LoginWithAuthData(platform, authData, option.FailOnNotExist));
 }
Exemple #2
0
 /// <summary>
 /// 使用 Union Id 绑定第三方登录
 /// </summary>
 /// <param name="authData"></param>
 /// <param name="platform"></param>
 /// <param name="unionId"></param>
 /// <param name="option"></param>
 /// <returns></returns>
 public Task AssociateAuthDataAndUnionId(Dictionary <string, object> authData, string platform, string unionId,
                                         LCUserAuthDataLoginOption option = null)
 {
     if (authData == null)
     {
         throw new ArgumentNullException(nameof(authData));
     }
     if (string.IsNullOrEmpty(platform))
     {
         throw new ArgumentNullException(nameof(platform));
     }
     if (string.IsNullOrEmpty(unionId))
     {
         throw new ArgumentNullException(nameof(unionId));
     }
     if (option == null)
     {
         option = new LCUserAuthDataLoginOption();
     }
     MergeAuthData(authData, unionId, option);
     return(LinkWithAuthData(platform, authData));
 }
Exemple #3
0
 static void MergeAuthData(Dictionary <string, object> authData, string unionId, LCUserAuthDataLoginOption option)
 {
     authData["platform"]     = option.UnionIdPlatform;
     authData["main_account"] = option.AsMainAccount;
     authData["unionid"]      = unionId;
 }