Exemplo n.º 1
0
        protected virtual string GetToken()
        {
            if (Context?.Session?[moderateSessionTokenKey] != null)
            {
                var sessionToken = (TokenResponse)Context.Session[moderateSessionTokenKey];
                if (sessionToken.Expires_On != null && sessionToken.ExpirationDate >= DateTime.Now)
                {
                    return(sessionToken.Access_Token);
                }
            }

            var token = RepositoryClient.SendContentModeratorTokenRequest(ApiKeys.ContentModeratorPrivateKey, ApiKeys.ContentModeratorClientId);

            Context.Session.Add(moderateSessionTokenKey, token);

            return(token.Access_Token);
        }