ICOS-Carbon-Portal / meta

ICOS Carbon Portal metadata service
GNU General Public License v3.0
3 stars 1 forks source link

incorrect username and password while trying to get cookies #237

Closed de-ranit closed 8 months ago

de-ranit commented 9 months ago

I am getting an incorrect username or password, every time I try to get the cookies. I also checked my credentials multiple times and they seem correct to me and I can also login to ICOS data portal in web browser.

$ curl --cookie-jar cookies.txt --data "mail=<user email>&password=<password>" https://cpauth.icos-cp.eu/password/login

mirzov commented 9 months ago

Hello! Apologies for such a long delay. Can it be that you have special characters in your password? I have updated the README to explain what to do in this case: https://github.com/ICOS-Carbon-Portal/meta/commit/221aa6049bfde1cdc85fee9e64dcdfc079f94c05 Does this help?

de-ranit commented 8 months ago

Hi,

Thanks for your suggestion.

Indeed, I have special characters in my password. I tried using curl --cookie-jar cookies.txt --data-urlencode "mail=<email@email.com>&password=<password>" https://cpauth.icos-cp.eu/password/login. But now I get Need to be logged in as admin, using username/password account.

mirzov commented 8 months ago

No, you should not use --data-urlencode you should still use --data, but url-encode the password before placing it into the data string. Please follow the updated instruction and get back. Also, may I suggest trying out a new Python library that helps with authentication: https://pypi.org/project/icoscp_core/

de-ranit commented 8 months ago

I tried the updated instructions. I have _ in my password and browser's encodeURIComponent() gives _ for underscore encoding. So, the password remains the same after encoding and I get the Incorrect user name or password. I also tried replacing _ with %5f, but it also gives me the same error.

Thanks for the Python library. I will check it out.

mirzov commented 8 months ago

Well, it does seem like you are using an incorrect user name or password. To properly verify this, you can perform the following steps.

  1. Visit https://cpauth.icos-cp.eu/login/
  2. Choose "Password sign in" tab
  3. Enter the credentials you have been trying to use with curl
  4. Click the "Sign in" button.

If sign in works, then we can look further into the version of the curl and the operating system that you are using. If this does not work, then maybe you have not created a username/password account with Carbon Portal, were using alternative sign in methods instead (e.g. University sign in), and were trying to use the credentials of that method. To verify what login method you have used, you can visit https://cpauth.icos-cp.eu/home/, scroll down to the bottom of the page, and inspect the "API token" panel. For a local username/password sign-in, it should look like this (note "Source: Password"): image

de-ranit commented 8 months ago

Yes, the normal sign-in through web browser works perfectly with the same credentials and the source is also password as shown in the screenshot.

I have tried getting the cookie file using curl on two computers. curl -V gives me the followings.

curl 7.61.1 (x86_64-redhat-linux-gnu) libcurl/7.61.1 OpenSSL/1.1.1k zlib/1.2.11 brotli/1.0.6 libidn2/2.2.0 libpsl/0.20.2 (+libidn2/2.2.0) libssh/0.9.4/openssl/zlib nghttp2/1.33.0
Release-Date: 2018-09-05
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz brotli TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL

and

curl 7.79.1 (x86_64-apple-darwin21.0) libcurl/7.79.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.11 nghttp2/1.45.1
Release-Date: 2021-09-22
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: alt-svc AsynchDNS GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL UnixSockets
mirzov commented 8 months ago

I propose that we continue this investigation via direct email communication. Please find me here and write to me, preferably from the email address that you used to sign in. I can then reset your password to another value (which I disclose to you), and test your account directly. You will afterwards be able to change it back.