0

I am currently following the Sitecore CLI Documentation and testing it out on one of my local sitecore environment.

I am executing the command

dotnet sitecore ser pull

and I am getting this error.

You are not authorized to perform the task you are attempting. You may need to be assigned additional permissions.

Anyone know how to resolve this? Thanks in advance.

4 Answers 4

2

I don't know if this is recommended to update the settings on the config Sitecore.Services.GraphQL.Serialization.config but it does resolve my issue by updating the requireAuthentication node to false (Default: true).

<security type="Sitecore.Services.GraphQL.Hosting.Security.GraphQLSecurity, Sitecore.Services.GraphQL">
          <requireAuthentication>false</requireAuthentication>
          <requireApiKey>false</requireApiKey>
        </security>

I am now able to pull the items that I want to serialize.

1
  • Indeed it's not recommended as anyone could call the endpoint and change data Sep 21, 2020 at 6:20
0

Assuming you are using Admin or some other account to log in (sitecore login --cm ... --authority https://..., is someone else in your group also using Sitecore CLI? do you have a .sitecore directory? If so then there is a user.json file in there, which contains the token. Try deleting that file and logging in again. The user.json should not be checked in to source control.

1
  • I am only using a local environment and only use administrator user. I have already tried deleting the file and logging in again but still the same.
    – Jovit Mayo
    Sep 18, 2020 at 6:33
0

I also ran into the same error.

I remembered disabling OWIN in the site settings by Sitecore.Owin.Authentication.Disabler.config.

I solved it when I enabled OWIN.

0

The first step is to check if a user is created within Sitecore.

When the The Sitecore CLI user is created without an emailaddress, which causes the exception.

Second Check SQL Membership provider in your web.config.

This error only occurs when you have set requiresUniqueEmail to true

<membership defaultProvider="sitecore" hashAlgorithmType="SHA1">
  <providers>
    <clear />
    <add name="sitecore" type="Sitecore.Security.SitecoreMembershipProvider, Sitecore.Kernel" realProviderName="sql" providerWildcard="%" raiseEvents="true" />
    <add name="sql" type="System.Web.Security.SqlMembershipProvider" connectionStringName="security" applicationName="sitecore" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" maxInvalidPasswordAttempts="5" />
    <add name="disabled" type="Sitecore.Security.DisabledMembersipProvider, Sitecore.Kernel" applicationName="sitecore" />
    <add name="switcher" type="Sitecore.Security.SwitchingMembershipProvider, Sitecore.Kernel" applicationName="sitecore" mappings="switchingProviders/membership" />
  </providers>
</membership>

Make it False and Save the config. Hope this helps, Nikhil!

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.