Exemplo n.º 1
0
        async Task CacheToken(MobileServiceUser user)
        {
            var claims   = JwtUtility.GetClaims(user.MobileServiceAuthenticationToken);
            var settings = new StoreSettings
            {
                UserId    = claims[JwtClaimNames.Subject],
                Email     = claims["email"],
                FirstName = claims[JwtClaimNames.GivenName],
                LastName  = claims[JwtClaimNames.FamilyName],
                RoleName  = claims["role"],
                AuthToken = user.MobileServiceAuthenticationToken
            };

            await SaveSettingsAsync(settings);
        }
Exemplo n.º 2
0
 async Task SaveSettingsAsync(StoreSettings settings) =>
 await MobileService.SyncContext.Store.UpsertAsync(nameof(StoreSettings), new[] { JObject.FromObject(settings) }, true);