vscode: unable to verify token
Created by: ptxmac
- Sourcegraph version: sourcegraph.com
- Platform information: vscode extension v2.2.1
Steps to reproduce:
- Try to log in to sourcegraph using a access token
- It fails with "Unable to verify your access token"
Expected behavior:
The vscode extension should send an authenticated request to the server
Actual behavior:
I used nc
to open a tpc server and looked at the request the extension is sending:
$ nc -l 8899
POST /.api/graphql?CurrentAuthState HTTP/1.1
0: Authorization
0: token 123
accept-encoding: gzip,deflate
user-agent: node-fetch/1.0 (+https://github.com/bitinn/node-fetch)
connection: close
accept: */*
content-length: 731
Host: localhost:8899
{"query":"\n query CurrentAuthState {\n currentUser {\n __typename\n id\n databaseID\n username\n avatarURL\n email\n displayName\n siteAdmin\n tags\n url\n settingsURL\n organizations {\n nodes {\n id\n name\n displayName\n url\n settingsURL\n }\n }\n session {\n canSignOut\n }\n viewerCanAdminister\n tags\n tosAccepted\n searchable\n }\n }\n","variables":{}}^C⏎
Note in the top that the Authorization header is not send correctly - it looks like the input is some sort of array (?) being marshalled to text incorrectly.
The correct way to send HTTP authorization headers is Authorization: token 123
My guess is that there are a bug somewhere in the configuration of the HTTP client used by the vscode extension