Skip to content

User Code expiration is not considered #1977

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

Open
antoinelauzon-bell opened this issue Apr 17, 2025 · 0 comments
Open

User Code expiration is not considered #1977

antoinelauzon-bell opened this issue Apr 17, 2025 · 0 comments
Labels
type: bug A general bug

Comments

@antoinelauzon-bell
Copy link

Hi,

Describe the bug

OAuth2DeviceVerificationAuthenticationProvider only gets the provided user code but does not check its expiration. It means that a user can input an expired user code and still "complete" the flow on its second device. The flow would later fail on the /oauth2/token call because the device code is expired.

To Reproduce

Use the "DemoAuthorizationServerApplication" sample.

Before starting the sample, reduce the device/user code duration (to not wait too long):

.tokenSettings(TokenSettings.builder().deviceCodeTimeToLive(Duration.ofSeconds(30)).build())

Start a device code flow with some scope(s). For example, use the request below to start the flow:

POST http://localhost:9000/oauth2/device_authorization
scope=message.read&client_id=device-messaging-client

Wait for the expiration (30s) before continuing the flow on the second device (i.e. entering http://localhost:9000/activate?user_code=X in a browser).

The browser shows that the flow "correctly" completed. But once the tokens are requested (token endpoint), it return the error "expired_token". It seems to me that the error happens too late. The user should be blocked on its second device because the user code is expired.

Expected behavior

An error should occur on the second device if the user code is expired.

I can provide additional details, just let me know.

Thank you

@antoinelauzon-bell antoinelauzon-bell added the type: bug A general bug label Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant