Example #1
0
        internal static Task <ParseUser> LogInWithAsync(string authType,
                                                        IDictionary <string, object> data,
                                                        CancellationToken cancellationToken)
        {
            ParseUser user = null;

            return(UserController.LogInAsync(authType, data, cancellationToken).OnSuccess(t => {
                user = (ParseUser)ParseObject.CreateWithoutData <ParseUser>(null);
                user.HandleFetchResult(t.Result);

                lock (user.mutex) {
                    if (user.AuthData == null)
                    {
                        user.AuthData = new Dictionary <string, IDictionary <string, object> >();
                    }
                    user.AuthData[authType] = data;
                    user.SynchronizeAllAuthData();
                }

                return SaveCurrentUserAsync(user);
            }).Unwrap().OnSuccess(t => user));
        }