Radek336
Radek336

Reputation: 1

Strapi: GraphQL mutation without authentication

I program simple e-shop based on Strapi. I need to open my custom "order" mutation to public without any JWT token but I can't figure out how. Is it possible to do that in Strapi? Thanks.

Upvotes: 0

Views: 648

Answers (2)

misha130
misha130

Reputation: 5746

Look at https://docs.strapi.io/developer-docs/latest/plugins/graphql.html#extending-the-schema:

resolversConfig has a property called auth which is like:

auth: false to fully bypass the authorization system and allow all requests

So for example you need to specify your mutation name:

  resolversConfig: {
    'Mutation.updateAddress': {
      auth: false,
    },
  },

Otherwise just override your resolver

Upvotes: 0

KONDRATJEV
KONDRATJEV

Reputation: 86

In Strapi v4 you can do it like this:

  1. Go to "Settings";
  2. Open "Roles";
  3. Click on the "Public" role;
  4. Expand the desired model in the "Permissions" section;
  5. Specify which endpoints you want to give rights.

In your case it is "create".

Upvotes: 1

Related Questions