Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api-graphql): add libraryOptions to generateServerClientUsingCookies #12979

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

asp3
Copy link

@asp3 asp3 commented Feb 7, 2024

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: #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 asp3 requested a review from a team as a code owner February 7, 2024 22:31
@asp3
Copy link
Author

asp3 commented Feb 7, 2024

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

@asp3 asp3 changed the title feat(api-graphql): add library options to generateServerClientUsingCookies feat(api-graphql): add libraryOptions to generateServerClientUsingCookies Feb 7, 2024
@nadetastic nadetastic self-assigned this Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Next.js Amplify v6 Server side Authorization header issue
2 participants