예제 #1
0
        public async Task <long> AuthenticateAsync(string username, string password)
        {
            _tokens = await FetchTokensAsync(new Dictionary <string, string> {
                { "username", username }, { "password", password }
            }, "password");

            return(_tokens.ExpiresIn);
        }
예제 #2
0
        public async Task <long> RefreshAsync()
        {
            if (_tokens == null)
            {
                throw new InvalidOperationException("You need to authenticate before attempting to refresh the authentication");
            }

            _tokens = await FetchTokensAsync(new Dictionary <string, string> {
                { "refresh_token", _tokens.RefreshToken }
            }, "refresh_token");

            return(_tokens.ExpiresIn);
        }