Open iliakan opened 1 year ago
You can check this github proxy, it authorises the requests and lets you git push too. I assume something similar would work with wasm-git too.
You can also alter the XMLHttpRequest.prototype.open
in the worker to set the request header with bearer token or basic auth. This is how I do it in WebAssembly Music:
XMLHttpRequest.prototype._open = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function (method, url, async, user, password) {
this._open(method, url, async, user, password);
this.setRequestHeader('Authorization', `Bearer ${accessToken}`);
lastHttpRequest = this;
}
Let's say we cloned a (public) github repository.
Is there a way to push there?
The only problem I see is credentials (reading can be public, writing - cannot). Any other issues?
For credentials, let's say, we're using our proxy (we have to do so anyway due to same-origin policy). Maybe we can use a Github App to get permissions for a repo, and then add these credentials to push requests (basically add auth tokens to requests)?