Example #1
0
        public async Task <UserDetail> GetUser(string firebaseToken)
        {
            User cachedUser;
            var  cacheKey   = firebaseToken;
            bool doesExists = memoryCache.TryGetValue(cacheKey, out cachedUser);

            if (!doesExists)
            {
                var user = await authProvider.GetUserAsync(firebaseToken);

                if (user is null)
                {
                    throw new FirebaseAuthException(string.Empty, string.Empty, string.Empty, new InvalidOperationException());
                }

                if (user.IsEmailVerified)
                {
                    memoryCache.Set(cacheKey, user, cacheEntryOptions);
                }

                return(new UserDetail(user.LocalId, user.Email, user.IsEmailVerified, false));
            }

            return(new UserDetail(cachedUser.LocalId, cachedUser.Email, cachedUser.IsEmailVerified, false));
        }
Example #2
0
 public async Task <User> GetUser(string token)
 {
     return(await _authProvider.GetUserAsync(token));
 }