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

feat: Can fetch a token based on the device code #323

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

dbolson
Copy link
Contributor

@dbolson dbolson commented Jun 18, 2024

During login, after receiving a verification URL, we can make a request to it and, after the user has allowed access, it returns an access token.

Additional PRs will poll the endpoint and handle the various errors it can return.

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

Provide links to any issues in this repository or elsewhere relating to this pull request.

Describe the solution you've provided

Provide a clear and concise description of what you expect to happen.

Describe alternatives you've considered

Provide a clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context about the pull request here.

@@ -22,7 +22,7 @@ func (c *mockClient) MakeRequest(
) ([]byte, error) {
args := c.Called(method, path, data)

return data, args.Error(1)
return args.Get(0).([]byte), args.Error(1)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should return the Return part of the mock, not the method's input.

@@ -38,11 +38,17 @@ func TestFetchDeviceAuthorization(t *testing.T) {
}`),
).Return([]byte(`{
"deviceCode": "test-device-code",
"expiresIn": 0000000001,
"expiresIn": 1,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this is an int.

@dbolson dbolson merged commit 769b925 into main Jun 18, 2024
2 checks passed
@dbolson dbolson deleted the sc-240965/fetch-token branch June 18, 2024 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants