Home > Enterprise >  How do I test the API using REST CodeceptJS, access to which is protected with Auth0?
How do I test the API using REST CodeceptJS, access to which is protected with Auth0?

Time:11-12

I want to use the REST helper (for CodeceptJS) to write automated tests for API

The difficulty lies in the fact that access to the API is protected by OAuth2.

If someone had experience passing OAuth2 authorization to write autotests using REST CodeceptJS, I would be very grateful if you could tell me about your case

CodePudding user response:

You can add a default header in your helper as below with OAuth2 :

REST: {
      endpoint: 'https://baseurl/endpoint',
      defaultHeaders:{
        Authorization: 'Bearer xxxtoken'
      },
    },
  • Related