Exemplo n.º 1
0
        /// <summary>
        /// Revokes a channel access token.
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        public async Task <LineClientResult <ResponseItem> > RevokeToken(string token)
        {
            if (string.IsNullOrEmpty(token))
            {
                throw new ArgumentNullException("The parameter token should not be empty or null");
            }

            var request = new LinePostFormUrlEncodedRequest <ResponseItem>(this, $"oauth/revoke");

            request.Params.Add(new KeyValuePair <string, string>("access_token", token));

            return(await request.Execute(null));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Issues a short-lived channel access token.
        /// </summary>
        /// <param name="issueTokenRequest"></param>
        /// <returns></returns>
        public async Task <LineClientResult <AccessTokenResponse> > IssueToken(IssueTokenRequest issueTokenRequest)
        {
            if (issueTokenRequest == null)
            {
                throw new ArgumentNullException(nameof(IssueTokenRequest));
            }

            var request = new LinePostFormUrlEncodedRequest <AccessTokenResponse>(this, $"oauth/accessToken");

            request.Params.Add(new KeyValuePair <string, string>("grant_type", issueTokenRequest.grant_type));
            request.Params.Add(new KeyValuePair <string, string>("client_id", issueTokenRequest.client_id));
            request.Params.Add(new KeyValuePair <string, string>("client_secret", issueTokenRequest.client_secret));

            return(await request.Execute(issueTokenRequest));
        }