예제 #1
0
        /// <summary>
        /// Registers new user using custom register controller. Access is to authorized requests is not granted.
        /// Call <see cref="Login(string, string)"/> method for this purpose.
        /// </summary>
        /// <param name="email">The email.</param>
        /// <param name="password">The password.</param>
        /// <returns>Registration result.</returns>
        public async Task <RegistrationResult> Register(string email, string password)
        {
            var registrationRequest = new RegistrationRequest()
            {
                UserId = email, Password = password
            };
            var ret = await _mobileServiceClient.InvokeApiAsync <RegistrationRequest, RegistrationResult>(
                _customRegistrationControllerName, registrationRequest);

            return(ret);
        }
예제 #2
0
        private async Task <string> CustomProviderAuthentication(RefreshTokenInfo refreshTokenInfo)
        {
            try
            {
                var ret = await _mobileServiceClient.InvokeApiAsync <CustomLoginResult>(
                    _customLoginControllerName, HttpMethod.Get, new Dictionary <string, string> {
                    { "userId", refreshTokenInfo.UserId }, { "refreshToken", refreshTokenInfo.RefreshToken }
                });

                if (ret != null)
                {
                    _mobileServiceClient.CurrentUser = new MobileServiceUser(ret.UserId)
                    {
                        MobileServiceAuthenticationToken = ret.MobileServiceAuthenticationToken
                    };
                    refreshTokenInfo.RefreshToken = ret.RefreshToken;
                    _accountStoreService.StoreTokenInSecureStore(refreshTokenInfo);
                    return(_mobileServiceClient.CurrentUser.MobileServiceAuthenticationToken);
                }
                else
                {
                    return(string.Empty);
                }
            }
            catch (MobileServiceInvalidOperationException)
            {
                return(string.Empty);
            }
        }
예제 #3
0
 public async Task Verify()
 {
     await _mobileServiceClient.InvokeApiAsync(_verificationControllerName);
 }
예제 #4
0
 public async Task <JToken> GetCurrentAccountInformation()
 => await _mobileServiceClient.InvokeApiAsync(_accountsControllerName);