Skip to content

chore: implement device auth flow for fake idp #11707

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

Merged
merged 9 commits into from
Jan 22, 2024

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Jan 19, 2024

Device Flow faking

Device flow: https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps

The fake IDP has been used to test all our oauth flows. I introduced a regression (fixed here #11706) because we were not checking the Accept header for the proper mime type. I could have just implemented that check, but I want to implement this for future testing.

Will also implement better error handling to return a better error if this happens again.

Kooha-2024-01-19-11-33-33.mp4

Copy link
Member Author

Emyrk commented Jan 19, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @Emyrk and the rest of your teammates on Graphite Graphite

@Emyrk Emyrk force-pushed the stevenmasley/fake_device_flow branch from b72cea9 to da21464 Compare January 19, 2024 18:33
@Emyrk Emyrk requested a review from code-asher January 19, 2024 18:33
Comment on lines 1077 to 1083
_, _ = fmt.Fprint(rw, url.Values{
"device_code": {deviceCode},
"user_code": {flow.userInput},
"verification_uri": {verifyURL},
"expires_in": {strconv.Itoa(int(lifetime.Seconds()))},
"interval": {"3"},
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this use .Encode()? Otherwise it could be printed as map[device_code:[] ...] or whatever the string representation of url.Values is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, good catch

@Emyrk Emyrk enabled auto-merge (squash) January 19, 2024 20:12
@Emyrk Emyrk force-pushed the stevenmasley/fake_device_flow branch from f88117e to 9bc29db Compare January 22, 2024 20:35
@Emyrk Emyrk merged commit 8e0a153 into main Jan 22, 2024
@Emyrk Emyrk deleted the stevenmasley/fake_device_flow branch January 22, 2024 20:46
@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants