0

I have create react component of connected GraphQL. It's giving me proper data. I have created user and assign roles and giving permission for the root. I want to pass his credentials with that query and then data will be display.

Can anyone help me into this? Thanks in advance.

2 Answers 2

3

Sitecore uses cookies for authentication. If an authenticated user's cookies are passed to the GraphQL API, it will respect that. If no authentication is present from cookies, any impersonation user set on the API key will be used.

1

You can authenticate your graphQL calls in two different ways,

  1. Using the API Key
  2. Login to Sitecore and Impersonate the User who logged in

When you use the API key with your graphQL, basically it impersonates the user which is given in the "Impersonation User" field of the API key. So your query works based on the security & roles assigned to the user entered in "Impersonation User" field in API KEY item.

enter image description here

But when you login to Sitecore using the auth service and invoke the graphQL then the graphQL will use the user who logged in and the query will basically use the roles & security assigned to the user. Refer Sitecore auth services for login.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.