Пример #1
0
        public async Task WhenAuthorizeShouldCallAuthorizeUrlWithRequiredParameters()
        {
            StubDefaultResponses();
            await _sut.Authorize();

            _httpTest.ShouldHaveCalled(_mauticClientConfiguration.BaseUrl + MauticClientConfiguration.OAuth2Url)
            .With(call => call.Request.RequestUri.Query.Contains($"client_id={_oAuth2Credentials.ClientId}"))
            .With(call => call.Request.RequestUri.Query.Contains("grant_type=authorization_code"))
            .With(call => call.Request.RequestUri.Query.Contains($"redirect_uri={_oAuth2Credentials.RedirectUri}"))
            .With(call => call.Request.RequestUri.Query.Contains("response_type=code"));
        }
Пример #2
0
        static void Main(string[] args)
        {
            var oauthCredentials = new OAuth2Credentials("CLIENT_ID",
                                                         "CLIENT_SECRET",
                                                         "REDIRECT",
                                                         "USER", "PWD");
            var auth = new MauticAuthorization(oauthCredentials, new MauticClientConfiguration("URL_MAUTIC"));

            auth.Authorize().Wait();
        }