updateAuthProfile

📘

Important

The Buy with Prime API is offered as a preview and might change as we receive feedback and iterate on the interfaces. We are sharing this early documentation to help you learn about the Buy with Prime API as we write and iterate on the content.

Overview

Update a previously created Auth Profile.

Response

Return type UpdateAuthProfileResponse

Arguments

ArgumentDescription
input (UpdateAuthProfileInput)

The unique identifier of the AuthProfile to delete.

Examples


Update Auth Profile For Oauth

Request

mutation {
    updateAuthProfile(
        input: {
            authProfileId: "example-auth-profile-alias",
            authConfig: {
                oAuthConfig: {
                    clientParameters: {
                        clientId: "new-client-id",
                        clientSecret: "new-client-secret"
                    },
                    authEndpoint: "https://auth-endpoint.com",
                    httpMethod: POST,
                    httpParameters: {
                        bodyParameters: [
                            {
                                key: "grant_type",
                                value: "client_credentials"
                            },
                            {
                                key: "scope",
                                value: "write:order"
                            }
                        ],
                        headerParameters: [
                            {
                                key: "Content-Type",
                                value: "application/x-www-form-urlencoded"
                            }
                        ]
                    }
                }
            }
        }
    ) {
        authProfileId
    }
}

Response

{
  "data": {
    "createAuthProfile": {
      "authProfileId": "example-auth-profile-alias"
    }
  }
}

Update Auth Profile For Basic Auth

Request

mutation {
    updateAuthProfile(
        input: {
            authProfileId: "example-auth-profile-alias",
            authConfig: {
                basicAuthConfig: {
                    username: "example-new-username",
                    password: "example-new-password"
                }
            }
        }
    ) {
        authProfileId
    }
}

Response

{
  "data": {
    "createAuthProfile": {
      "authProfileId": "example-auth-profile-alias"
    }
  }
}

Update Auth Profile For Oauth Using Invalid Auth Profile Id

Request

mutation {
    updateAuthProfile(
        input: {
            authProfileId: "invalid-auth-profile-alias",
            authConfig: {
                oAuthConfig: {
                    clientParameters: {
                        clientId: "invalid-client-id",
                        clientSecret: "new-client-secret"
                    },
                    authEndpoint: "https://auth-endpoint.com",
                    httpMethod: POST,
                    httpParameters: {
                        bodyParameters: [
                            {
                                key: "grant_type",
                                value: "client_credentials"
                            },
                            {
                                key: "scope",
                                value: "write:order"
                            }
                        ],
                        headerParameters: [
                            {
                                key: "Content-Type",
                                value: "application/x-www-form-urlencoded"
                            }
                        ]
                    }
                }
            }
        }
    ) {
        authProfileId
    }
}

Response

{
  "errors": [
    {
      "message": "You do not have sufficient access to perform this action.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "updateAuthProfile"
      ],
      "extensions": {
        "classification": {
          "type": "AccessDeniedError",
          "errorType": "AccessDeniedException",
          "errorCode": 403
        }
      }
    }
  ],
  "data": null
}

Update Auth Profile For Oauth Using Invalid Auth Config

Request

mutation {
    updateAuthProfile(
        input: {
            authProfileId: "example-auth-profile-alias",
            authConfig: {
                oAuthConfig: {
                    clientParameters: {
                        clientId: "invalid-client-id",
                        clientSecret: "new-client-secret"
                    },
                    authEndpoint: "https://auth-endpoint.com",
                    httpMethod: POST,
                    httpParameters: {
                        bodyParameters: [
                            {
                                key: "grant_type",
                                value: "client_credentials"
                            },
                            {
                                key: "scope",
                                value: "write:order"
                            }
                        ],
                        headerParameters: [
                            {
                                key: "Content-Type",
                                value: "application/x-www-form-urlencoded"
                            }
                        ]
                    }
                }
            }
        }
    ) {
        authProfileId
    }
}

Response

{
  "errors": [
    {
      "message": "Input request is not valid. Retrying the same request is not likely to succeed. An example could be query or argument value is not correct or valid.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "updateAuthProfile"
      ],
      "extensions": {
        "classification": {
          "type": "ValidationError",
          "code": "UnspecifiedError",
          "details": {},
          "errorType": "ValidationException",
          "errorCode": 400
        }
      }
    }
  ],
  "data": null
}