public void Can_authenticate_using_JWT_with_QueryString() { var client = GetClientWithBasicAuthCredentials(); var authResponse = client.Post(new Authenticate()); Assert.That(authResponse.BearerToken, Is.Not.Null); var request = new Secured { Name = "test" }; var url = Config.ListeningOn.CombineWith(request.ToGetUrl()) .AddQueryParam(Keywords.TokenCookie, authResponse.BearerToken); var response = url.PostJsonToUrl("{}") .FromJson <SecuredResponse>(); Assert.That(response.Result, Is.EqualTo(request.Name)); }
public void Can_authenticate_using_JWT_with_FormData() { var client = GetClientWithBasicAuthCredentials(); var authResponse = client.Post(new Authenticate()); Assert.That(authResponse.BearerToken, Is.Not.Null); var request = new Secured { Name = "test" }; var url = Config.ListeningOn.CombineWith(request.ToGetUrl()); var response = url.PostToUrl(new Dictionary <string, string> { { Keywords.TokenCookie, authResponse.BearerToken } }, accept: MimeTypes.Json) .FromJson <SecuredResponse>(); Assert.That(response.Result, Is.EqualTo(request.Name)); }