Skip to content
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

Problem with Bearer token #58

Open
cislapi opened this issue Dec 5, 2023 · 1 comment
Open

Problem with Bearer token #58

cislapi opened this issue Dec 5, 2023 · 1 comment

Comments

@cislapi
Copy link

cislapi commented Dec 5, 2023

It is not possible to login using bearer token.

The token type is always BASIC
https://github.com/elaichenkov/playwright-zephyr/blob/main/src/zephyr.service.ts#L40

    this.password = options.password!;
    let tokenType = 'Basic'
    if (this.authorizationToken ){
      tokenType = 'Bearer     //  <------ Bearer if authorizationToken
   }
    this.basicAuthToken = Buffer.from(`${this.user}:${this.password}`).toString('base64');
    this.authorizationToken = options.authorizationToken ?? this.basicAuthToken;
    this.projectKey = options.projectKey;

    this.axios = axios.create({
      baseURL: this.url,
      headers: {
        'Content-Type': 'application/json',
        Authorization: `${tokenType} ${this.authorizationToken}`,   <---------------
      },
@elaichenkov
Copy link
Owner

Hey,
The Basic token is only for the Zephyr Server version. If you are using Cloud version, then you need to use cloud reporter. For instance:

// playwright.config.ts
const config: PlaywrightTestConfig = {
  reporter: [
    ['playwright-zephyr/lib/src/cloud', { // <-- Reporter for the Zephyr Scale cloud version
      projectKey: 'JARV', // <-- Replace with your project key
      authorizationToken: process.env.ZEPHYR_AUTH_TOKEN, // <-- Replace with your authorization token
    }],
  ],
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants