AlexGustafsson / itslearning

A fully async API written in ES6 for the It's Learning platform
https://alexgustafsson.github.io/itslearning/
11 stars 3 forks source link

3rd Party Auth #7

Open tarna opened 2 years ago

tarna commented 2 years ago

I know this project is old and abandoned but is there any way to use this library to authenticate yourself when the organization uses a 3rd party site for authentication.

AlexGustafsson commented 2 years ago

I no longer use or have access to It's Learning, so it's not necessarily abandon, just feature complete or stale. There is no built-in way to authenticate yourself if a third-party login is used. You may, however, be able to get the cookie from a browser and use with the User constructor:

https://github.com/AlexGustafsson/itslearning/blob/355c46ef52cbf319ef86dd4c819ea815dc45706d/lib/user.js#L22-L26

If you're accustomed to programming yourself, it's typically rather simple to implement logins. You'd want to find what happens when you click "sign in" on the third-party website (typically a HTTP POST with some credentials to an API), then mimic what the browser does. In the end, you'll likely receive a cookie or a token from the server, which you can then use in this library.

If you ever do solve it, or fix something up with this library, please feel free to open up a pull request or leave hints to other users.

Good luck!