virtUOS / edusharing-opencast-importer

This importer harvests episodes (lecture recordings) from Opencast instances and push it as external references to an Edusharing instance.
GNU General Public License v3.0
2 stars 2 forks source link

Refresh expired auth-token #23

Closed jduehring closed 2 years ago

jduehring commented 2 years ago

This PR addresses #16 .

By using axios interceptors I added a method to insert the latest auth-token right before each request to the edusharing API. Also if the token is invalid, another interceptor will refresh the token and retry the original request with it. If it fails again. an appropriate error is thrown.

Code should work, but I need to to some final testing and a bit of cleanup. I also needed to make the authObj a global variable in order to make this fix work. It is not really pretty this way and we should probably target to create something like a localStorage class to make the code more clean and secure.

Will mark this as "ready for review" as soon as I finished the tests/cleanup, but you can already have a look at it, if you want.

PS: I'm not sure why there are some ~9000 deletions in the packege-lock.json, but everything seems to work just fine.

ffeyen commented 2 years ago

Works After merge update-thumbnails.js has to be fixed closes #16