diff --git a/packages/api-graphql/src/internals/InternalGraphQLAPI.ts b/packages/api-graphql/src/internals/InternalGraphQLAPI.ts index 6411ad17f46..5b291746b5f 100644 --- a/packages/api-graphql/src/internals/InternalGraphQLAPI.ts +++ b/packages/api-graphql/src/internals/InternalGraphQLAPI.ts @@ -226,7 +226,8 @@ export class InternalGraphQLAPIClass { } = resolveConfig(amplify); // Retrieve library options from Amplify configuration - const { headers: customHeaders } = resolveLibraryOptions(amplify); + const { headers: customHeaders, withCredentials } = + resolveLibraryOptions(amplify); let customHeadersOptions; @@ -309,6 +310,7 @@ export class InternalGraphQLAPIClass { headers, body, signingServiceInfo, + withCredentials, }, abortController, }); diff --git a/packages/api-graphql/src/utils/resolveLibraryOptions.ts b/packages/api-graphql/src/utils/resolveLibraryOptions.ts index 1f61b833dfb..3213c357b90 100644 --- a/packages/api-graphql/src/utils/resolveLibraryOptions.ts +++ b/packages/api-graphql/src/utils/resolveLibraryOptions.ts @@ -7,6 +7,6 @@ import { AmplifyClassV6 } from '@aws-amplify/core'; * @internal */ export const resolveLibraryOptions = (amplify: AmplifyClassV6) => { - const headers = amplify.libraryOptions?.API?.GraphQL?.headers; - return { headers }; + const { headers, withCredentials } = amplify.libraryOptions?.API?.GraphQL; + return { headers, withCredentials }; }; diff --git a/packages/core/src/singleton/API/types.ts b/packages/core/src/singleton/API/types.ts index 678ce45d79d..67bebddc6e2 100644 --- a/packages/core/src/singleton/API/types.ts +++ b/packages/core/src/singleton/API/types.ts @@ -9,6 +9,7 @@ export type LibraryAPIOptions = { query: string; variables?: Record; }) => Promise; + withCredentials: boolean; }; REST?: { // custom headers for given REST service. Will be applied to all operations.