Skip to content

Unable to login to server with 0.23.1 update #513

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
d-akara opened this issue Feb 7, 2020 · 22 comments
Closed

Unable to login to server with 0.23.1 update #513

d-akara opened this issue Feb 7, 2020 · 22 comments
Labels

Comments

@d-akara
Copy link
Contributor

d-akara commented Feb 7, 2020

  • VSCode Version: 1.42.0
  • OS Version: osx 10.14.6
  • REST Client Version: 0.23.1

Steps to Reproduce:

I attempt to login to my server, but it continues to request authorization.

I reinstalled 0.23.0 and login is successful.
I'm not sure what change is causing an issue yet.

@d-akara
Copy link
Contributor Author

d-akara commented Feb 7, 2020

So another hint, it might be session or cookie related.
The difference in behavior occurs after the login attempt.
So, I hit the login URL, and the response seems to be the same as 0.23.0
Now, when I hit a second URL on the server, 0.23.1 results in getting a response back that I'm not logged in.

@Huachao
Copy link
Owner

Huachao commented Feb 7, 2020

@dakaraphi I really did some change in the cookieJar, and what do you mean the second URL? And do you have Cookie header in your request headers and you setting for rest-client.rememberCookiesForSubsequentRequests?

@Huachao
Copy link
Owner

Huachao commented Feb 7, 2020

@dakaraphi Maybe the bug occurs that on the redirection the outgoing request headers don't contain the previously received cookies.

@Huachao Huachao added the bug label Feb 7, 2020
@d-akara
Copy link
Contributor Author

d-akara commented Feb 7, 2020

So, I was incorrect about the login URL. I am getting a different response back from the server.
I have a login URL like

{{host}}{{context}}/j_security_check?j_username={{username}}&j_password={{password}}

This is the response shown in the result with 0.23.0

x-com-ibm-team-scenario: 127.0.0.1
X-XSS-Protection: 1; mode=block
Content-Type: text/html;charset=UTF-8
Content-Encoding: gzip
Connection: close
Server: Jetty(8.1.16.v20140903)

This is the response shown in the result with 0.23.1

Set-Cookie: JazzFormAuth=Form;Path=/jazz;Secure
Expires: Thu, 01 Jan 1970 00:00:00 GMT
X-com-ibm-team-repository-web-auth-msg: authrequired
X-XSS-Protection: 1; mode=block
Content-Type: text/html;charset=UTF-8
Content-Encoding: gzip
Connection: close
Server: Jetty(8.1.16.v20140903)

@Huachao
Copy link
Owner

Huachao commented Feb 7, 2020

@dakaraphi since multiple redirections happen in the full login flow, is this response you pasted the first response with 3XX and how did you get this response

@Huachao
Copy link
Owner

Huachao commented Feb 7, 2020

@dakaraphi I guess the root cause is that when I call the redirected URL, the request doesn't carry the cookies stored in cookieJar

@d-akara
Copy link
Contributor Author

d-akara commented Feb 7, 2020

That response came from the response shown in VSCode window using the REST Client

@Huachao
Copy link
Owner

Huachao commented Feb 12, 2020

@dakaraphi I think I have fixed this issue, can you please try this version as before,
rest-client-0.23.1.vsix.txt

@Huachao Huachao closed this as completed Feb 12, 2020
@d-akara
Copy link
Contributor Author

d-akara commented Feb 12, 2020

@Huachao unfortunately it still does not work

@Huachao Huachao reopened this Feb 13, 2020
@Huachao
Copy link
Owner

Huachao commented Feb 13, 2020

@dakaraphi could you please provide more details about your request, like if Cookie headers exists and your setting for rest-client.rememberCookiesForSubsequentRequests

@Huachao
Copy link
Owner

Huachao commented Feb 13, 2020

@dakaraphi could you please provide more details about your request, like if Cookie headers exist and your setting for `rest-client.rememberCookiesForSubsequentRequests? And how many redirections happen, and what's the request flow direction, like from site A to site B and finally site C? Also can you also paste the response as previously?

@Huachao
Copy link
Owner

Huachao commented Feb 13, 2020

@dakaraphi Please help to verify this version too which removes all the cookies related work in since version 0.23.0
rest-client-0.23.1.vsix.txt

@d-akara
Copy link
Contributor Author

d-akara commented Feb 13, 2020

The version you posted still does not work.
rest-client.rememberCookiesForSubsequentRequests is set true

Could you point me to the REST client code I should try to debug? I will try to see if I can see the problem.

@Huachao
Copy link
Owner

Huachao commented Feb 14, 2020

@dakaraphi if still not working, I think it's maybe not related to cookie jar. Previously I think the most possible code piece exsits in httpClient.ts. Especially the preprareOptions method

private async prepareOptions(httpRequest: HttpRequest): Promise<got.GotBodyOptions<null>> {

Thanks for you to help me to investigate the root cause 😄

@d-akara
Copy link
Contributor Author

d-akara commented Feb 18, 2020

Just posting a status update:
Still looking into this issue; however, the problem does not occur for me when I run the code in the vscode debugger. I will try to add logging into the code as next step since I can't seem to use the debugger.

@Huachao
Copy link
Owner

Huachao commented Feb 18, 2020

@dakaraphi thanks for the update, it's a little strange that the package I sent to you not working. If it really works, you can try the vsce package command, and try the version.

@d-akara
Copy link
Contributor Author

d-akara commented Feb 18, 2020

So it seems that when I build the package, it works for me. However, the packages you sent me or the one on the marketplace does not work for me.
I can only assume a difference in the node_modules from doing a fresh npm install plus npm audit fix.

@Huachao
Copy link
Owner

Huachao commented Feb 19, 2020

@dakaraphi the marketplace version is not working as expected since I haven't published a new release. Can you try the package built from my machine today?
rest-client-0.23.1.vsix.txt

@d-akara
Copy link
Contributor Author

d-akara commented Feb 19, 2020

@Huachao yes, that build does work! :-)

@Huachao Huachao closed this as completed Feb 19, 2020
@Huachao
Copy link
Owner

Huachao commented Feb 19, 2020

@dakaraphi OK, I'd like to close the issue

@Huachao
Copy link
Owner

Huachao commented Mar 9, 2020

@dakaraphi you can try this in the latest verison 0.23.2.

@d-akara
Copy link
Contributor Author

d-akara commented Mar 9, 2020

@Huachao it is working. Thanks!

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

No branches or pull requests

2 participants