Skip to content

Unable to authenticate #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ghuntley opened this issue Nov 9, 2022 · 1 comment · Fixed by #93
Closed

Unable to authenticate #86

ghuntley opened this issue Nov 9, 2022 · 1 comment · Fixed by #93

Comments

@ghuntley
Copy link
Contributor

ghuntley commented Nov 9, 2022

After pasting the session token into the wizard initClientSession w/CoderRestClientService fails

Response{protocol=http/1.1, code=401, message=Unauthorized, url=https://dev.coder.com/api/v2/users/me}

Thus workspaces are not displayed.

codersdk

session_token:

debug

cookies

 0 = {HttpCookie@14071} "session_token=3WU8HLU5wV-redact"
 1 = {HttpCookie@14072} "csrf_token=recfHuNDh28KUuU5ibJfg+EhP/PRAsqpOxdqMBmasg0="
domainIndex = {HashMap@14066}  size = 1
 "dev.coder.com" -> {ArrayList@14079}  size = 2

token is indeed not null

3WU8HLU5wV-redact

response headers

0 = "Content-Type"
1 = "application/json; charset=utf-8"
2 = "Set-Cookie"
3 = "csrf_token=recfHuNDh28KUuU5ibJfg+EhP/PRAsqpOxdqMBmasg0=; Path=/; HttpOnly; SameSite=Lax"
4 = "Traceparent"
5 = "00-4d59641885f3cb38cdf05293c53b1705-ac97719758fd860e-01"
6 = "Vary"
7 = "Cookie"
8 = "X-Coder-Build-Version"
9 = "v0.12.5-devel+d82364b9"
10 = "X-Coder-Request-Id"
11 = "7af719cc-17f3-4f2d-86dd-8900f9ee154d"
12 = "X-Ratelimit-Limit"
13 = "512"
14 = "X-Ratelimit-Remaining"
15 = "511"
16 = "X-Ratelimit-Reset"
17 = "1667961060"
18 = "X-Span-Id"
19 = "ac97719758fd860e"
20 = "X-Trace-Id"
21 = "4d59641885f3cb38cdf05293c53b1705"
22 = "Date"
23 = "Wed, 09 Nov 2022 02:30:27 GMT"
24 = "Content-Length"
25 = "175"

request url

https://dev.coder.com/api/v2/users/me

request method

GET

request headers

0 = "Host"
1 = "dev.coder.com"
2 = "Connection"
3 = "Keep-Alive"
4 = "Accept-Encoding"
5 = "gzip"
6 = "Cookie"
7 = "session_token=3WU8HLU5wV-redact"
8 = "User-Agent"
9 = "okhttp/4.9.3"
@deansheather
Copy link
Member

Try changing the session token to be set as a header Coder-Session-Token instead of a cookie session_token.

fioan89 added a commit that referenced this issue Nov 21, 2022
- cookie was renamed from seesion_token to coder_session_token
- resolves #86
fioan89 added a commit that referenced this issue Nov 22, 2022
Upgrade coder client authentication API

- resolves Unable to authenticate #86
- authentication to REST API is no longer using cookies.
- upgraded REST models
- upgraded Gradle plugin and dependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants