Beispiel #1
0
        private async Task <OAuthSession> JWTAuthPostAsync(string assertion)
        {
            BoxRequest boxRequest = new BoxRequest(_boxConfig.BoxApiHostUri, Constants.AuthTokenEndpointString)
                                    .Method(RequestMethod.Post)
                                    .Header(Constants.RequestParameters.UserAgent, _boxConfig.UserAgent)
                                    .Payload(Constants.RequestParameters.GrantType, Constants.RequestParameters.JWTAuthorizationCode)
                                    .Payload(Constants.RequestParameters.Assertion, assertion)
                                    .Payload(Constants.RequestParameters.ClientId, _boxConfig.ClientId)
                                    .Payload(Constants.RequestParameters.ClientSecret, _boxConfig.ClientSecret);

            var converter = new BoxJsonConverter();
            IBoxResponse <OAuthSession> boxResponse = await _boxService.ToResponseAsyncWithoutRetry <OAuthSession>(boxRequest).ConfigureAwait(false);

            boxResponse.ParseResults(converter);

            return(boxResponse.ResponseObject);
        }