Skip to content
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

Unexpected problem with password auth #1

Open
ChimekKoo opened this issue Feb 4, 2023 · 2 comments
Open

Unexpected problem with password auth #1

ChimekKoo opened this issue Feb 4, 2023 · 2 comments
Assignees

Comments

@ChimekKoo
Copy link
Owner

Recently authorization stopped working, probably they ended password grant type support or done something to the API key I'm using here.
API response when trying to get access token using user credentials:

400 Bad Request
 {"error": "unsupported_grant_type"}

I can't do much about it.

(https://github.com/lomber1/py-librus-api which uses the same Librus API also stopped working)

@dani3l0
Copy link

dani3l0 commented Mar 10, 2023

Hello, I had the same problem in my project at the end of January. And it was using the same auth method as yours.

I captured all the requests while logging in to Librus React web ui, and managed to successfully repeat the process in my code. Basically, I've rewritten the whole auth (commit, code).
We now have to make just 5 requests to login properly xD.

Those are the login steps:

  • [GET] https://api.librus.pl/OAuth/Authorization?client_id=46&response_type=code&scope=mydata - initialize session? save some cookies? idk, but seems to be needed
  • [POST] https://api.librus.pl/OAuth/Authorization?client_id=46 - the actual login, form data with login & password. Some cookie is saved, but hold on, you don't have access to anything.
  • [GET] https://api.librus.pl/OAuth/Authorization/Grant?client_id=46 - here we get our access token (as cookie). While we can get HTML contents of the webpage, API still cannot be accessed.

Activating the API. Don't ask me how and why does it work, I have really no idea what is happening in Librus backend (just like its devs I guess).

  • [GET] https://synergia.librus.pl/gateway/api/2.0/Auth/TokenInfo - here we get some weird User Identifier, which is required in next step.
  • [GET] https://synergia.librus.pl/gateway/api/2.0/Auth/UserInfo/{Identifier} - does not return anything useful. However, after this request API starts working.

Librus seemed to be cleaning up their API during the winter break.

@ChimekKoo
Copy link
Owner Author

Wow thanks a lot. I'll implement it soon.

@ChimekKoo ChimekKoo self-assigned this Mar 11, 2023
@ChimekKoo ChimekKoo changed the title Unexpected problem with password authorization Unexpected problem with password auth Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants