AlexGustafsson/itslearning

3rd Party Auth

Opened this issue · 1 comments

tarna commented

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.

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:

itslearning/lib/user.js

Lines 22 to 26 in 355c46e

constructor(data) {
this[accessToken] = data['access_token'];
this[refreshToken] = data['refresh_token'];
this[tokenTimeout] = Date.now() + data['expires_in'];
this[organisation] = data.organisation;

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!