(OAuth)
Use this endpoint to retrieve an OAuth token. Use the token to allow your ecommerce server to make calls to the Account endpoint and create a one-click checkout experience for shoppers.
https://help.bolt.com/products/accounts/direct-api/oauth-guide/
- GetToken - Get OAuth token
Retrieve a new or refresh an existing OAuth token.
package main
import(
"github.com/speakeasy-sdks/Test_Bolt_API/pkg/models/shared"
testboltapi "github.com/speakeasy-sdks/Test_Bolt_API"
"context"
"log"
)
func main() {
s := testboltapi.New(
testboltapi.WithSecurity(shared.Security{
APIKey: testboltapi.String("<YOUR_API_KEY_HERE>"),
}),
)
ctx := context.Background()
res, err := s.OAuth.GetToken(ctx, shared.GetAccessTokenRequest{
ClientID: "<value>",
ClientSecret: "<value>",
Code: "<value>",
GrantType: shared.GrantTypeAuthorizationCode,
Scope: []shared.Scope{
shared.ScopeBoltAccountManage,
},
})
if err != nil {
log.Fatal(err)
}
if res.GetAccessTokenResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
shared.GetAccessTokenRequest | ✔️ | The request object to use for the request. |
*operations.OauthGetTokenResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 4XX | application/json |
sdkerrors.SDKError | 4xx-5xx | / |