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

Call to consent accept/reject for a second time gives error #1256

Closed
condemil opened this issue Jan 14, 2019 · 9 comments
Closed

Call to consent accept/reject for a second time gives error #1256

condemil opened this issue Jan 14, 2019 · 9 comments
Assignees
Labels
bug Something is not working.
Milestone

Comments

@condemil
Copy link
Contributor

condemil commented Jan 14, 2019

Describe the bug
When I call hydra API endpoint PUT /oauth2/auth/requests/consent/{id]/reject or /accept for a second time with the same id it gives the error back:

An error occurred while handling a request" code=409 details="map[]" error="Error 1062: Duplicate entry '{id}' for key 'PRIMARY': Unable to insert or update resource because a resource with that value exists already

To Reproduce
Steps to reproduce the behavior:

  1. Call PUT /oauth2/auth/requests/consent/{id]/reject twice
  2. See error in Hydra logs

Expected behavior
I expect that this behavior is handled correctly, I think the best approach is to validate the existing primary key in db and return same response as for the first call.

Screenshots
N/A

Version:

  • Environment: Hydra Alpine docker image
  • Version: v1.0.0-rc.6_oryOS.1

Additional context
N/A

@aeneasr
Copy link
Member

aeneasr commented Jan 14, 2019

The error is handled correctly though with a 409. What problem are you facing when the error is returned? Is it that you need to check for the 409 error state explicitly?

@condemil
Copy link
Contributor Author

I see error in Hydra logs, I expect errors to be something that should be fixed in code or do Hydra app use some different approach?

level=error msg="An error occurred while handling a request" code=409

@condemil
Copy link
Contributor Author

Another problem I am facing is that when I receive the 409 error the redirect_to is not available in the response and I cannot redirect user back properly. Imagine the situation when the first request was handled and connection broke before consent provider received the response and consent provider is re-sending it once again.

@aeneasr
Copy link
Member

aeneasr commented Jan 14, 2019

Yeah that makes sense, tracking

@aeneasr aeneasr added the bug Something is not working. label Jan 14, 2019
@aeneasr aeneasr modified the milestones: v1.1.0, unplanned, v1.0.0 Jan 14, 2019
@aeneasr aeneasr self-assigned this Jan 14, 2019
@condemil
Copy link
Contributor Author

Actually I just checked and see the same error for PUT /oauth2/auth/requests/consent/{id}/accept call too.

@condemil condemil changed the title Call consent reject for a second time gives error Call to consent accept/reject for a second time gives error Jan 14, 2019
@kewde
Copy link

kewde commented Jan 21, 2019

I ran into the same/similar issue but with DIFFERENT CHALLENGE IDs.

This occurs when consent remember is set to true and consent has been granted.
A second new request will have the consent information with skiptrue.
I was unable to accept the consent and redirect the user.

I'm using an in-memory cookie jar which gets destroyed each run. Occurs over different consent challenges.

@aeneasr
Copy link
Member

aeneasr commented Jan 21, 2019

This occurs when consent remember is set to true and consent has been granted.
A second new request will have the consent information with skiptrue.
I was unable to accept the consent and redirect the user.

This is because you've probably forgot to set remember to false when skip is true. This was intended as a safeguard but has lead to issues and will be fixed soon ( #1165 ).

@kewde
Copy link

kewde commented Jan 21, 2019

Thanks, that solved it indeed!

@xiven
Copy link

xiven commented Feb 5, 2019

I'm running into an issue where when I make the login request I notice that the login_challenge is not getting set on the response. I'm thinking this may be why I always have skip set to false on the accept consent response when I log in again even though I set the remember flag to true from the consent form. I'm not sure if that is related to #1165.
Why would the login_challenge not be getting set on login?

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

No branches or pull requests

4 participants