コード例 #1
0
        /// <summary>
        /// Gets the authentication url to approve a request token.
        /// </summary>
        /// <param name="result">The request token result.</param>
        /// <param name="redirectTo">A url to redirect to after user approved the request token.</param>
        /// <returns>A string contaning the url to authenticate the user.</returns>
        public static string GetAuthenticationUrl(this RequestTokenResult result, string redirectTo = null)
        {
            if (result is null)
            {
                throw new ArgumentNullException(nameof(result));
            }

            string url = $"https://www.themoviedb.org/authenticate/{result.RequestToken}";

            if (!string.IsNullOrWhiteSpace(redirectTo))
            {
                url += $"?redirect_to={redirectTo}";
            }

            return(url);
        }
コード例 #2
0
        public async Task<RequestTokenPayload> RequestTokenAsync(
            [Service] IIdentityService identityService,
            TokenRequestInput input,
            CancellationToken cancellationToken)
        {
            RequestTokenResult tokenResult = await identityService.RequestTokenAsync(
                new TokenRequestData(
                    input.Authority,
                    input.ClientId,
                    input.Secret,
                    input.GrantType,
                    input.Scopes,
                    input.Parameters)
                {
                    RequestId = input.RequestId,
                    SaveTokens = input.SaveTokens
                },
                cancellationToken);

            return new RequestTokenPayload(tokenResult);
        }
コード例 #3
0
 public RequestTokenPayload(RequestTokenResult token)
 {
     Result = token;
 }