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

isLoggedIn() function #5

Open
slushyash opened this issue Dec 24, 2013 · 4 comments
Open

isLoggedIn() function #5

slushyash opened this issue Dec 24, 2013 · 4 comments

Comments

@slushyash
Copy link

Is there any way to write an isLoggedIn() function without accessing the grades website ?

We might be able to use a HEAD request as shown here: http://stackoverflow.com/questions/333634/http-head-request-in-javascript-ajax. That way we would just get the header: if it's 500 we know that we need to login again, but if it is 200 we know that we don't need to login again.

@tristanseifert
Copy link

This seems like a good approach, but do we know if the server supports HEAD requests? If I recall correctly, most servers need to be explicitly configured to accept HEAD requests, and considering the server is some Microsoft concoction, I'm not sure if that's the case. Can someone look into that?

@slushyash
Copy link
Author

I tried the following in cURL: curl -I https://accesscenter.roundrockisd.org/homeaccess/Student/Gradespeed.aspx?target=https://gradebook.roundrockisd.org/pc/displaygrades.aspx (-I sends a HEAD request). It worked and gave me a 500 Internal Server Error like it should. On my machine it took an average of 0.7 seconds. Wonder if there's a faster way :/.

@slushyash
Copy link
Author

I think the alternative is that we measure how long it takes for GradeSpeed to time out and keep a timestamp every time we request GradeSpeed-related information. That might be a faster way, but perhaps more error-prone.

@tristanseifert
Copy link

I have implemented HEAD requests in qhac-ios as a method for detecting if the user is logged in or not, which works relatively well. Even though the districts we currently support run horribly broken web servers, the HEAD request, if not logged in, will return either a 500 (not logged in) or a 200 if the current session is valid.

AISD is a bit strange, in that the server doesn't necessarily return a 500 if the session expired, so instead, code should interpret any HTTP status code besides 200 OK as an error that requires re-authentication.

@xsznix xsznix added this to the 2014 refactor milestone May 5, 2014
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

3 participants