amplify-js icon indicating copy to clipboard operation
amplify-js copied to clipboard

feat(api-graphql): add libraryOptions to generateServerClientUsingCookies

Open asp3 opened this issue 1 year ago • 1 comments

Description of changes

In Amplify.configure (client side), we are able to override libraryOptions in order to use the idToken. However, this option is not available on server side.

Amplify.configure(awsConfig, {
    ssr: true,
    API: {
        GraphQL: {
            headers: async () => ({
                Authorization: (await fetchAuthSession()).tokens?.idToken?.toString(),
            }),
        },
    },
});

This PR allows libraryOptions to be passed into generateServerClientUsingCookies

Issue #, if available

fixes: https://github.com/aws-amplify/amplify-js/issues/12971

Description of how you validated changes

Local Dev Server w/ fork

Checklist

  • [ X ] PR description included
  • [ X ] yarn test passes
  • [ X ] Tests are changed or added
  • [ X ] Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

asp3 avatar Feb 07 '24 22:02 asp3

my first time opening a PR, please let me know if there's anything that should be changed/fixed

asp3 avatar Feb 07 '24 22:02 asp3