-
Notifications
You must be signed in to change notification settings - Fork 1
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
Edit returning 404 #94
Comments
Hmm i ran into this today and tried to fix it for a whole 2 hours, it's something weird happening to the |
I have managed to reproduce this behavior only twice, and still not sure what's causing it.
|
Hi 👋 I was bored and thought I'd look at this - is it the OTP giving the 404 or the Data Entry app? The only place that data entry sends a 404 is in the Also, could be something to do with this cookie expiring after 5 minutes possibly? |
I lied, Data Entry could also potentially send a 404 here if it gets a 404 back from the OTP. Good luck, this seems tough. |
Can you put a request logger in otp and also data entry |
@m4v15 sorry my bad it was a 400, the API would respond with a 401 ( Unauthorized ), not sure why cause i am a
@des-des |
@Karyum maybe your Auth Code has expired on the OTP end? Not sure what the length of them are set to, will have a look at the OTP OAuth stuff later if I get a chance |
I think the access token's expire after an hour, so possibly if your are logged in for over an hour with the same code you will get that? I should really do some real work |
Yeah i guess that would be it, @des-des maybe a solution for that would be to have a refresh login in the nav-bar, thoughts ? |
@Karyum @m4v15 Finding it quite hard to dig around all the code here. The lifetime of the access token is indeed one hour: https://oauth2-server.readthedocs.io/en/latest/api/oauth2-server.html#token-request-response-options-callback. See the default time on the access token. The correct thing to do here is to use the refresh token to generate a new access token. @m4v15 if I am correct, we have not added this functionality Good solution
@Karyum this is not an easy task, if you fancy doing something hard, that involves reading lots of code + api docs, you should give this a go! ✨ @Karyum FYI |
@des-des yeah, refresh token functionality isn't set up, I don't think it's too much more that actually needs to be implemented in order for it to work, but yeah this:
is accurate. I kind of had an understanding of it at one point and nearly got it working, but I was deep in OAuth land at the time. Also, have you confirmed it's the access token expiring that's causing the bug?
Yeah to be honest I think we took the wrong route with the authentication stuff here and it could do with a bit of a refactor, it's really hard to follow when re-reading it. |
@des-des just to be clear the way we should deal with it right now is to remove the token and redirect the user to the login page so he can get a new one correct ? also @m4v15 there is a branch in the OTP called refreshTry is this where you were trying to implement the refresh token feature |
Lol, I imagine it is, yes |
i just noticed the md link screw up 😅 |
So after looking into the OTP code for a while, and try stuff even if i change the expiration time of the cookie on the OTP ( locally ) to 5 seconds still takes an hour for the token to not work anymore. also i found out the data entry was over writing the the OTP's cookie, cause both of them were called the solution that i thought of for the data entry to deal with the 404 unauthorized issue is to send the user back to OTP's login page for now does that sound good to you for now @des-des ? oh also what about extending the cookie's expiration date to more than an hour ? something like 4 hours cause it makes more sense doesn't it ? |
Err I'm sure @des-des can be more clear on this but pretty sure as those cookie's will be from different servers they won't be overwritten or anything - otherwise any server could accidentally overwrite the cookie from any other server. |
There are two authentication methods on OTP. The one that uses cookies you are not interested in.
@Karyum you are correct about the alternative solution, I left it out. Bad Solution
|
After looking through the OTP's code for a while and checking out now in order for this to work these changes need to happen:
I only have 2 small questions:
|
I think we are just doing that because the docs say we should :D |
@Karyum On your first question, I am not 100% sure. But the functions defined there are used internally by the oauth module, so I will go with lubs and say that its what the docs told us to do. Question 2: You are right to say we do not have functionality to change the grants of a currently existing client. First, manipulate the db directly to add this, second, make sure new clients get given this automatically! |
so what i need to do is:
|
Wikid: Here is some more specs: http://oauth2-server.readthedocs.io/en/latest/model/overview.html?highlight=grant#refresh-token-grant
|
@des-des do you think we still should extend the token's expiry date or keep it an hour since we are implementing the refresh token functionality now? |
@Karyum if we have the refresh token no need to extend the exp |
Edit didn't work and it didn't say why it didn't work it just gave a 404.
EPIC: #90
The text was updated successfully, but these errors were encountered: