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

How to integrate with apollo client? #38

Open
brielov opened this issue May 22, 2020 · 1 comment
Open

How to integrate with apollo client? #38

brielov opened this issue May 22, 2020 · 1 comment

Comments

@brielov
Copy link

brielov commented May 22, 2020

I have a simple graphql netlify function and I would like to integrate react-netlify-identity. Is there a built in method I can use? Or some other way around?

@elijahsullivan
Copy link

elijahsullivan commented Aug 20, 2020

@brielov I'm not sure you're still in search of an answer to this question, but these resources might help provide some context:

If your Apollo Client is pointing to your .netlify/functions GraphQL URI. You can include the logged in user's JWT in the Authorization header of your request (or perhaps when the ApolloClient is instantiated). You can access the user in your React code with this library through the useIdentityContext hook.

If a Netlify function is called with a valid identity JWT you should be able to access the user information from the context parameter of your Netlify functions.

export function(event, context, callback) {
  const { identity, user } = context.clientContext;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants