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")); }
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(); }