Getting An Unauthorized error

When I run the debug I seem to be getting an: MigrateAllRepos.WriteReposCSV: WriteReposCSV.GetReposRESTCall: Response status code does not indicate success: 401 (Unauthorized).

I’ve followed all the process so Im not exactly sure where I went wrong.

This is the trace Log:
WriteReposCSV Trace Log:
URL Constructed https://api.bitbucket.org/2.0/repositories/TonyLoubser?page=1&pagelen=100
HTTP client created
Added Basic authorization header.
Sending GET request
Request Headers: None
Response received

Response code: 401 (Unauthorized)
Response Body:


The 401 error indicates that the call to fetch the list of repos is not authenticated. Please:

  1. Make sure the BitbucketAppPassword in the settings of your Linx solution is correct
  2. Check on Bitbucket that the BitbucketAppPassword has the correct rights
  3. The value in the BitbucketWorkspace in the settings of your Linx solution (TonyLoubser) is correct
  4. Make sure the BitbucketUsername in the settings of your Linx solution is correct
    Let me know if all these details seem correct, but you still have problems with our migration solution
    Franz

Im still getting the error and I have made sure all the information it correct in terms of what is said to add.

it seems to stop at the function of WriteReposCSV and doesnt go any further than that

Do I have to fill any of the other information as well other than the
bitbucketAppPassword,
BitbucketUsername,
BitbucketWorkspace,
GitUserName,
GitUserEmail and the MainDirectory.

How exactly does the ApiURL work do I need to add anything to it?

You don’t need to complete anything other than the items you listed above. There is nothing you need to do with the APIUrl setting as it uses the value from the BitbucketWorkspace setting to construct the url that is used in the REST call to retreive your Mercurial repos from Bitbucket. In your case, this is url is:
https://api.bitbucket.org/2.0/repositories/TonyLoubser?page=1&pagelen=100
If you are getting a 401 error then the authentication is not successful. This means that there is a problem with one of the settings below or with the permissions of the BitbucketAppPassword on Bitbucket (read & write):

  1. BitbucketAppPassword
  2. BitbucketUsername
  3. BitbucketWorkspace
    I assume you are using 2-factor authentication on yoru account? If not, you should try switch that on and see if it makes a difference.
    Let me know if you still have trouble.
    Franz

I have added the bitbucketApp Password and double checked it. I have also Added the username and the bitbucket workspace. I am not using a 2 factor authentication at the moment as Im missing a few other things to do so. Is there a way I might be able to convert one repo using this process. Do I need to add the username and the login password anywhere.

Is there other specific reasons why it wont get past the WriteReposCSV function. Should the repos have an ssh key and not be using the https way of cloning?

why is it when I put this https://api.bitbucket.org/2.0/repositories/TonyLoubser?page=1&pagelen=100 in the browser that I get a result which seems to be a json result.

|pagelen|100|
|values|[]|
|page|1|
|size|0|

Ive also seem to get an error when I was checking the breakdown i the RepoList folder for the function WriteRepoCSV and at the GetReposRestCall there seems to an error that says Value is not a well-formed URL.

The step where the process is failing is supposed to fetch a list of your Mercurial repos from your Bitbucket account and write this list to a CSV file. The clone step is later in the process, but the debugger is not reaching that step.
My suggestion for you is to send an email to support@linx.software with your solution (including the settings you are using). We can then test the process and see what exaclty is happening.

by settings do u mean the details that one enters including the bitbucketApp password?

Yes. The problem is in the authentication step, so, we can only help you if we can try authenticating with a working AppPassword. If you are not comfortable with that you could create a new AppPassword with only read permissions. That should be enough to resolve this problem.