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

Getting error code 403 Forbidden when trying to use bitbucket.projects.deleteProject #86

Open
sw-dev-code opened this issue Mar 23, 2021 · 3 comments

Comments

@sw-dev-code
Copy link

When I try to delete the Project I'm getting the 403 Forbidden code, even if I was able to DELETE the repositories in the previous step.

I'm able to delete the project from Postman using the same API as node-bitbucket is using.

Thank you in advance for the help.

@MunifTanjim
Copy link
Owner

Did you use the same credentials for all those operations?

403 Forbidden implies you're using a token which don't have permission to delete projects.

@sw-dev-code
Copy link
Author

@MunifTanjim I'm not using the token, I'm using the admin username/password for all operations. That user are able to create a project on Bitbucket Cloud.

@fran-kyso
Copy link

Same is happening to me, but in my case for listing all the repositories of an user.

This is the code:

test("Get all repositories", async () => {
    const bucket = new ReposBitbucketProvider();

    bucket.withUserAndPassword("[email protected]", "PASSWORD");
    const result = await bucket.getRepos("test-kyso", 1, 5);

    expect(result.name).toBe('test');    
});

When withUserAndPassword is:

async withUserAndPassword(username, password) {
    this.bitbucket = new Bitbucket({
      auth: {
        username: username,
        password: password,
      },
    });
  }

and getRepos is:

async getRepos(workspace, page, perPage) {
    const { data, headers } = await this.bitbucket.repositories.list({
      workspace: workspace,
      page: page, 
      pagelen: perPage
    });
    
    return data.values.map(repoMapFunction)
  }

It's curious, because if I use my personal account of Bitbucket I can retrieve all the repositories, but if I create a new fresh account, I've got a 403 Forbidden message.

I reviewed the permissions of the user, and it's an owner of everything... so can't be a permissions issue.

Any thoughts?

Thanks a lot!

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

3 participants