Skip to content

Missing state parameter in Authorization Consent request throws 500 #503

@guo-jun-airwallex

Description

@guo-jun-airwallex

Describe the bug
If client not pass state when authorization, it throws 500 error when user click cancel button in consent page.

The error was throwed in OAuth2AuthorizationCodeRequestAuthenticationToken

if (this.consent) {
    Assert.hasText(this.state, "state cannot be empty");
}

image
image

However click allow it can be redirected to client uri successful.
image

According to OAuth RFC, state is recommended in authorization endpoint.
So why we need to assert state when require consent?

To Reproduce

  1. Client open authorization url without state
  2. User login and click cancel button.
  3. Display 500 error page
    image

Expected behavior
state should be recommended for client, not only when user allow authorization but also reject.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions