createAuthProfile
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
Creates a new AuthProfile with the specified authentication configuration.
Response
Return type CreateAuthProfileResponse
Arguments
Argument | Description |
---|---|
input (CreateAuthProfileInput required) | Input parameters used when creating an Auth Profile. |
Examples
Create Auth Profile With Oauth Config
Request
mutation {
createAuthProfile(
input: {
authProfileAliasId: "example-auth-profile-alias",
authConfig: {
oAuthConfig: {
clientParameters: {
clientId: "client-id",
clientSecret: "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"
}
}
}
Create Auth Profile With Basic Auth Config
Request
mutation {
createAuthProfile(
input: {
authProfileAliasId: "example-auth-profile-alias",
authConfig: {
basicAuthConfig: {
username: "example-username",
password: "example-password"
}
}
}
) {
authProfileId
}
}
Response
{
"data": {
"createAuthProfile": {
"authProfileId": "example-auth-profile-alias"
}
}
}
Create Oauth Auth Profile With Invalid Auth Endpoint
Request
mutation {
createAuthProfile(
input: {
authProfileAliasId: "example-auth-profile-alias",
authConfig: {
oAuthConfig: {
clientParameters: {
clientId: "client-id",
clientSecret: "client-secret"
},
authEndpoint: "http://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, the following issues were encountered: [/createAuthProfile/input/authConfig/oAuthConfig/authEndpoint must match \"^https://.*\"]",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"createAuthProfile"
],
"extensions": {
"classification": {
"type": "ValidationError",
"code": "ValidationError",
"details": {},
"errorType": "ValidationException",
"errorCode": 400
}
}
}
],
"data": null
}
Create Oauth Auth Profile With Invalid Auth Config
Request
mutation {
createAuthProfile(
input: {
authProfileAliasId: "example-auth-profile-alias",
authConfig: {
oAuthConfig: {
clientParameters: {
clientId: "invalid-client-id",
clientSecret: "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": [
"createAuthProfile"
],
"extensions": {
"classification": {
"type": "ValidationError",
"code": "UnspecifiedError",
"details": {},
"errorType": "ValidationException",
"errorCode": 400
}
}
}
],
"data": null
}
Updated 5 days ago