예제 #1
0
        public async Task <FirebaseAuth> GetAuth()
        {
            if (_auth == null)
            {
                _auth = _accountStoreService.GetValue <FirebaseAuth>(FIREBASE_AUTH_ACCOUNT_PROPERTIES_KEY);

                // if auth wasn't in storage either, just return null
                if (_auth == null)
                {
                    return(null);
                }
            }
            if (_auth.IsExpired())
            {
                try
                {
                    // exception being thrown here sometimes
                    _auth = await FirebaseAuthProvider.RefreshAuthAsync(_auth);

                    SaveAuthToAccount();
                } catch (Exception ex)
                {
                    Debug.WriteLine("Encountered exception refreshing FirebaseAuth token: " + ex.Message);
                }
            }
            return(_auth);
        }