afragen / wp-dependency-installer

A lightweight class to add to WordPress plugins/themes to automatically install plugin dependencies.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What should the token for e.g. Bitbucket be?

hirasso opened this issue · comments

Hi there, what a nice library! Trying to make it work in my theme that depends on private plugins that I am hosting on bitbucket, I stumbled upon the token setting in wp-dependencies.json. What should this be? I only have a key and a secret from bitbucket right now (by setting up a consumer with read capabilities). I don't know much about the authentication process, would be grateful for a hint.

@hirasso the problem is that Bitbucket private repositories authenticate using Basic Auth headers. This framework doesn't allow for private Bitbucket repositories directly, however, you could download the private Bitbucket repository as a zip and use the direct method.

Hi @afragen , thanks so much for your quick response!! 😃

...how sad that this framework doesn't support connecting to private bitbucket repos. My imaginative use case for the plugin dependency installer was to be prepared, should I lose my machine and backups on travels. I could just buy a new one, clone my theme repo and pull in all specific dependencies...

Would your class work with private Gitlab repositories?

...actually, maybe an idea: I am already using Plugin Update Checker with my private Bitbucket-Repos. From their documentation:

//Optional: If you're using a private repository, create an OAuth consumer
//and set the authentication credentials like this:
//Note: For now you need to check "This is a private consumer" when
//creating the consumer to work around #134:
// https://github.com/YahnisElsts/plugin-update-checker/issues/134
$myUpdateChecker->setAuthentication(array(
	'consumer_key' => '...',
	'consumer_secret' => '...',
));

Would it maybe be possible to integrate the settings 'consumer_key' and 'consumer_secret' in your class, too?

You can use my GitHub Updater plugin to install public or private repositories from GitHub, Bitbucket, Gitlab, or Gitea. It does use the Basic Auth headers for Bitbucket private repositories. Unfortunately I haven’t yet figured out how to add oAuth.

As the other git hosts use access tokens it is much simpler to access private repositories with a properly scoped token. So yes, this framework works with public and private repositories for all the above git hosts except BItbucket.