Skip to content
This repository has been archived by the owner on Apr 16, 2020. It is now read-only.

sourcelink test in private github repo #371

Open
maxild opened this issue Sep 25, 2018 · 8 comments
Open

sourcelink test in private github repo #371

maxild opened this issue Sep 25, 2018 · 8 comments

Comments

@maxild
Copy link

maxild commented Sep 25, 2018

Just enabled SourceLink for a nupkg build with code in private github repo. Running the SourceLink V3 dotnet global tool

sourcelink test .\artifacts\Brf.HisClientFx.0.2.0-aGH-6-0001.nupkg -u  personal_access_token

give me a lot of 404 errors

.
.
https://raw.githubusercontent.com/maxild/HisClientFx/72acf10621facd60df91ef2f4ca2c9720e71e2b7/src/Brf.HisClientFx/Polyfills/ReflectionPolyfillExtensions.cs
error: url failed NotFound: Not Found
.
.

I can download source files with curl without getting 404 errors

curl --header "Authorization: token personal_access_token" --location "https://raw.githubusercontent.com/maxild/HisClientFx/72acf10621facd60df91ef2f4ca2c9720e71e2b7/src/Brf.HisClientFx/Polyfills/ReflectionPolyfillExtensions.cs"

We both now that requests that require authentication will return 404 on Github. So why does the tool fail to authenticate. Am I doing something wrong?

@ctaggart
Copy link
Owner

ctaggart commented Sep 25, 2018

 sourcelink test --help

Usage:  test [arguments] [options]

Arguments:
  path  path to pdb, dll or nupkg

Options:
  -f|--file <path>                the path to a dll or pdb in a nupkg
  -a|--use-auth <type>            Use authentication. Defaults to Basic
  -ae|--auth-encoding <encoding>  Encoding to use on authentication value. Defaults to ASCII
  -u|--username <username>        Username to use to authenticate
  -p|--password <password>        Password for the username that is use to authenticate
  -h|--help                       Show help information

I just looked at the code. Try adding a -a Basic.

@maxild
Copy link
Author

maxild commented Sep 25, 2018

But basic is the default value, so does that change anything?

@maxild
Copy link
Author

maxild commented Sep 25, 2018

@ctaggart Doesn't work with explicit Basic (=> 404), but the Authorization HTTP header is of the form

Authorization: <type> <credentials> 

but

sourcelink test .\artifacts\Brf.HisClientFx.0.2.0-aGH-6-0001.nupkg -a token -u personal_access_tokren

errors with Authentication type of token is not supported

@maxild
Copy link
Author

maxild commented Sep 25, 2018

I can also get

curl --header "Authorization: Basic base64('personal_access_token')" --location "https://raw.githubusercontent.com/maxild/HisClientFx/72acf10621facd60df91ef2f4ca2c9720e71e2b7/src/Brf.HisClientFx/Polyfills/ReflectionPolyfillExtensions.cs"

to work.

That is I base64 encode the ASCII(!) (not Unicode, unless UTF8...dotnet uses UTF16) representation of the token (or 'username:token' string...both work), but

sourcelink test .\artifacts\Brf.HisClientFx.0.2.0-aGH-6-0001.nupkg -a Basic -u base64(personal_access_token)

Invalid password value
Parameter name: password

Maybe the base64 encoding ring a bell. I have to leave, its late here.

@maxild
Copy link
Author

maxild commented Sep 26, 2018

@ctaggart BTW debugging in vs2017 works after adding , so the Visual Studio is able to authenticate with Github and download the (private) source...

Also the tool used to work with public Github repos for me, the only difference now I can't get it to authenticate with github

@maxild maxild closed this as completed Sep 26, 2018
@maxild
Copy link
Author

maxild commented Sep 26, 2018

@ctaggart BTW debugging in vs2017 works after adding, so the debugger in Visual Studio is able to authenticate with Github and download the source...Also the tool used to work for me with public Github repos...

@ctaggart
Copy link
Owner

@maxild Sounds like it may be a bug in this app, so I'll reopen and take a look when I have time.

@ctaggart ctaggart reopened this Sep 26, 2018
@maxild
Copy link
Author

maxild commented Sep 26, 2018

@ctaggart Oops didn't mean to close, glad you reopened it yourself:smile:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants