Skip to content

Commit

Permalink
Merge pull request #21 from BoltApp/yhsu/AddCreateTokenFromRefreshToken
Browse files Browse the repository at this point in the history
Add CreateTokenFromRefreshToken
  • Loading branch information
yuweihsu01 authored Feb 9, 2022
2 parents d4434df + 3f39b2d commit 7b6a13b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions oauth_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,16 @@ func (g *OauthGateway) CreateTokenFromCode(ctx context.Context, oAuthCredentialR
}
return nil, &invalidResponseError{resp}
}

func (g *OauthGateway) CreateTokenFromRefreshToken(ctx context.Context, oAuthCredentialRequest *OAuthCredentialRequest) (*OAuthCredentials, error) {
oAuthCredentialRequest.GrantType = "refresh_token"
resp, err := g.executeVersion(ctx, "POST", "oauth/access_tokens", oAuthCredentialRequest, apiVersion4)
if err != nil {
return nil, err
}
switch resp.StatusCode {
case 200:
return resp.oauth()
}
return nil, &invalidResponseError{resp}
}

0 comments on commit 7b6a13b

Please sign in to comment.