Skip to content

Commit 47f1444

Browse files
Merge pull request #85 from BriskoCube/master
add support for bitbucket Api tokens
2 parents c9d19ac + 449afb8 commit 47f1444

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/ScmBackup/Configuration/ConfigSource.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,18 @@ internal class ConfigSource
2929
/// </summary>
3030
public string Name { get; set; }
3131

32+
/// <summary>
33+
/// user name for api authentication, used only for Bitbucket
34+
/// See issue 84
35+
/// </summary>
36+
public string ApiAuthName { get; set; }
37+
3238
/// <summary>
3339
/// user name for authentication
3440
/// (can be a different than the user whose repositories are backed up)
3541
/// </summary>
3642
public string AuthName { get; set; }
37-
43+
3844
/// <summary>
3945
/// list of repository names which should be ignored
4046
/// </summary>

src/ScmBackup/Hosters/Bitbucket/BitbucketApi.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ public List<HosterRepository> GetRepositoryList(ConfigSource source)
2828

2929
if (source.IsAuthenticated)
3030
{
31-
request.AddBasicAuthHeader(source.AuthName, source.Password);
31+
// The new Bitbucket authentication method uses a different user for API authentication. See issue 84.
32+
var authName = string.IsNullOrWhiteSpace(source.ApiAuthName) ? source.AuthName : source.ApiAuthName;
33+
request.AddBasicAuthHeader(authName, source.Password);
3234
}
3335

3436
string url = "/2.0/repositories/" + source.Name;

0 commit comments

Comments
 (0)