使用LibGit2Sharp的Bitbucket身份验证 [英] Bitbucket authentication to use LibGit2Sharp

查看:87
本文介绍了使用LibGit2Sharp的Bitbucket身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用CSharp.Bitbucket库通过Bitbucket验证用户身份( ).这篇文章还指出,传递 x-oauth-basic 是可行的.

BitBucket问题 #7735 似乎声明将令牌作为用户名和 x-oauth-basic 传递也可以.

I used the CSharp.Bitbucket library to authenticate users with Bitbucket (https://github.com/scottksmith95/CSharp.Bitbucket). The authentication works fine, I get the token value and token secret values.

I have alredy written a logic - with the help of LibGit2Sharp (https://github.com/libgit2/libgit2sharp) - to clone/pull/push the content of the users repo. It works fine if the user authenticates with GitHub. In that case I have to provide the value of the access token for username and an empty string for password.

 LibGit2Sharp.Credentials credentials = new UsernamePasswordCredentials()
        {
            Username = [GITHUB ACCESS TOKEN], 
            Password =""
        };

But what about Bitbucket? Can I use LibGit2Sharp in this way? I couldn't find any documentation about this issue. I tried to use the token value and the token secret also for username, but it fails.

I would like to use Bitbucket with Git and Mercurial too. Is there a little trick which I couldn't realize this far?

Thank you for your help!

解决方案

This way of passing the token as the username with a blank password is specific to GitHub AFAIK (see this help article). The article also states that passing x-oauth-basic works.

The BitBucket issue #7735 seems to state that passing the token as the username and x-oauth-basic would also work.

这篇关于使用LibGit2Sharp的Bitbucket身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆