-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auth0 authentication #79
Comments
We can use const token = 'abc';
await pactum.spec()
.get('<url>')
.withHeaders('Authorization', `Bearer ${token}`)
.expectStatus(200) |
Would it be the same process for all these other auth methods as well: Digest, NTLM, API Keys, OAuth, HAWK etc |
Yes, for now. Currently the library doesn't have dedicated methods for handling different authentication methods. But we are open to add custom capabilities for the same. |
I am having problems and getting lots of errors trying to implement this: await pactum.spec() Is that the correct implementation i have tried different variations but still no luck. Any help would be greatly appreciated |
Are you able to make the same request in Postman? If you can, please capture the header value & use it in pactum headers. |
I ca get it working with |
ExamplesUsing Headers await pactum.spec()
.get('<url>')
.withHeaders('Authorization', 'Basic ' + Buffer.from(username + ':' + password).toString('base64'))
.expectStatus(200) Using withAuth await pactum.spec()
.get('<url>')
.withAuth(username, password)
.expectStatus(200) |
This worked for it("Check status code for TimePeriod.", async () => {
const DTBody = expected.reportData_body;
await pactum
.spec()
.post("http://localhost:3000/timeperiod")
.withHeaders("Authorization", `Bearer ${bearerToken}`)
.withBody(DTBody)
.expectStatus(200);
}); |
Thanks for posting |
I am fighting with getting it to work where the auth is part of the url? |
Not sure how to use basic auth as part of the URL. Raised an issue for the same in phin. As a workaround we can use Workingawait pactum.spec()
.get('https://the-internet.herokuapp.com/basic_auth')
.withAuth('admin', 'admin') Not Workingawait pactum.spec()
.get('https://admin:[email protected]/basic_auth') |
Alternatively, if you're using JWT, you may send the username and password as JSON to your "verifier" route.
|
As a workaround we can use await pactum.spec()
.get('https://the-internet.herokuapp.com')
.withAuth('admin', 'admin') This worked for me Thank you very much. |
Do you have any updates with reference to using different types of Auth methods (i.e. Digest in particular) ? |
I have never worked on the Digest authentication method. It would be great, if you can give us a sample working code written with phin. |
I am struggling to get it to work with aws Signature its working in postman but not in Pactum is there something am missing? |
How can I use OAuth / ("Bearer " + token) authentication with Pactumjs, I can use basic username and password authentication just not find a way to use Auth0. Any help would be much appreciated.
The text was updated successfully, but these errors were encountered: