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

Who is maintaining what branch of Magister v2? #2

Closed
gruijter opened this issue Oct 29, 2018 · 12 comments
Closed

Who is maintaining what branch of Magister v2? #2

gruijter opened this issue Oct 29, 2018 · 12 comments

Comments

@gruijter
Copy link

Hi @idiidk

Great to see you have added the new authentication scheme, and that you have published it as an npm package! I am however confused where the magister v2 is being maintained now. See also this issue:
simplyGits/MagisterJS#76

Note: the 'original' v2 has recently gotten some commits by @lieuwex. Could you please align with him on where/how to maintain this package?

I do like to see all commits being published as npm package!

@lieuwex
Copy link

lieuwex commented Oct 29, 2018

FWIW I've just released the first alpha version of magister.js v2

You can install it by using npm install --save magister.js@2.0.0-alpha.0, it isn't really tested
in a long time by me whatsoever.

This package isn't affiliated with Magister.js (it's completely newly written), but it may be a better alternative since it's actually maintained. I don't really know if @idiidk would rather continue on his own library or take over Magister.js. But that's up to him of course :)

@gruijter gruijter closed this as completed Nov 4, 2018
@idiidk
Copy link
Owner

idiidk commented Nov 4, 2018

Just to clarify, I totally would like to continue with magister.js and just deprecate this package. To get to the point where MagisterJS already is would take a pretty long time so it would just be wasted effort.

@netlob
Copy link
Contributor

netlob commented Nov 4, 2018

Ikr. I think that the best option too.

Weet je of magister.js ook een optie heeft om de auth data op te slaan zodat je later kan reautenticaten?

@gruijter
Copy link
Author

gruijter commented Nov 4, 2018

Ok, that is super! I will try to keep using magister.js v2 then :)

Great that you are willing to maintain it by the way 👍

@idiidk
Copy link
Owner

idiidk commented Nov 4, 2018

@Sj3rd Save the bearer token from the Magister object and reauthenticate with that token. If it's expired the login will just fail I guess.

@netlob
Copy link
Contributor

netlob commented Nov 4, 2018

@idiidk but how can I reauthenticate with the bearer token

I got the bearertoken by calling the login function

@idiidk
Copy link
Owner

idiidk commented Nov 4, 2018

@Sj3rd Set the parameter token on login {token: "IDIIDK"}

@netlob
Copy link
Contributor

netlob commented Nov 4, 2018

@idiidk But how do I call the login() function when there's no one logged in?

@idiidk
Copy link
Owner

idiidk commented Nov 4, 2018

@Sj3rd

getSchools('<schoolname>') // get schools matching '<schoolname>'
	.then((schools) => schools[0]) // get the first school
	.then((school) => magister({ // login
		school,
		token: "THis?"
	}))
	.then((m) => { // done logging in, say hi
		console.log(`Hey ${m.profileInfo.firstName}!`);
	}, (err) => { // something went wrong
		console.error('something went wrong:', err);
	});

@netlob
Copy link
Contributor

netlob commented Nov 4, 2018

@idiidk wat raar, ik krijg gewoon terug wat je zou verwachten (school, bearer etc), alleen de is profileInfo leeg, waardoor de api dus ook niet de privileges kan lezen en geen requests naar magister kan doen...

@gruijter
Copy link
Author

gruijter commented Nov 4, 2018

@idiidk @Sj3rd what is the benefit of re-authenticating with a token versus just logging in again with username/password?
I am pulling data from magister once an hour. What would be good practice to do then, concerning authentication?

@idiidk
Copy link
Owner

idiidk commented Nov 4, 2018

@gruijter Storing a token is a lot safer than just storing a plain password, but in your situation you probably still need to do that because tokens expire. We probably need to add token refreshing to MagisterJS to fully get rid of password storing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants