From c146af3fff44a883e94dc7c15fef361c6574749b Mon Sep 17 00:00:00 2001 From: Dan Enman Date: Mon, 11 Dec 2017 13:31:19 -0400 Subject: [PATCH 1/2] Use GET request for OAuth polling Use GetTokensOauthPollNotFound not PostTokensOauthPollNotFound --- cmd/github.go | 11 ++++------- specs/identity.yaml | 11 +++++------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/cmd/github.go b/cmd/github.go index 8521251..8e7fa69 100644 --- a/cmd/github.go +++ b/cmd/github.go @@ -19,7 +19,6 @@ import ( "github.com/manifoldco/manifold-cli/config" "github.com/manifoldco/manifold-cli/api" "github.com/manifoldco/manifold-cli/generated/identity/client/authentication" - "github.com/manifoldco/manifold-cli/generated/identity/models" ) var ( @@ -78,19 +77,17 @@ func githubWithCallback(ctx context.Context, cfg *config.Config, a *analytics.An timeout := time.After(pollingTimeout) tick := time.Tick(pollingTick) - op := authentication.NewPostTokensOauthPollParamsWithContext(ctx) - op.SetBody(&models.OAuthAuthenticationPoll{ - Secret: &state, - }) + op := authentication.NewGetTokensOauthPollParamsWithContext(ctx) + op.Secret = state for { select { case <-timeout: return cli.NewExitError("Unable to fetch authentication", -1) case <-tick: - loginResp, linkResp, err := identityClient.Identity.Authentication.PostTokensOauthPoll(op) + loginResp, linkResp, err := identityClient.Identity.Authentication.GetTokensOauthPoll(op) if err != nil { switch err.(type) { - case *authentication.PostTokensOauthPollNotFound: + case *authentication.GetTokensOauthPollNotFound: continue default: return err diff --git a/specs/identity.yaml b/specs/identity.yaml index 6e81d8c..837e42d 100644 --- a/specs/identity.yaml +++ b/specs/identity.yaml @@ -56,17 +56,16 @@ paths: schema: $ref: '#/definitions/Error' /tokens/oauth/poll: - post: + get: security: [] summary: Poll the exchange of a third-party OAuth 2 token for valid authentication parameters: - - name: body - in: body + - name: secret + in: query description: | - OAuth state information + The state secret to poll for authorization + type: string required: true - schema: - $ref: '#/definitions/OAuthAuthenticationPoll' tags: - Authentication responses: From 297ce9703bd00faff0d0333db4d74158f462a7fb Mon Sep 17 00:00:00 2001 From: Dan Enman Date: Wed, 13 Dec 2017 11:34:09 -0400 Subject: [PATCH 2/2] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 686f987..e8b3987 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - GitHub identity -- register a new account, login to or link an existing account to GitHub - GitHub identity -- update GitHub app ClientID +- GitHub identity -- Use GET for state polling - Reference to go-manifold updated to 0.9.1 release for verification code change ## [0.12.0] - 2017-11-30