2

I am trying to upgrade Sitecore Commerce 9 Initial Release to Update 1. One of the steps is to do bootstrap in Postman. When I do it, I am getting this exception:

Status Code: 401; Unauthorized

Steps to reproduce:

  1. I have already set "AntiForgeryEnabled" in config.json to false for Authoring and also for DevOps sites

  2. In Postman, I have disabled "SSL certificate verification" in Settings

  3. In Sitecore Collection in Postman, I have run GetToken command to get the authorization token

  4. I run "Bootstrap Sitecore Commerce" under "1 Environment Bootstrap" section of "SitecoreCommerce_DevOps" collection. Habitat Environment is chosen

How should I make my request for bootstrapping authorized?

What should I specify as SitecoreIdToken in Headers in Authorization key?

enter image description here

  • Do you have any information in your Commerce Authoring logs, when executing boostrap command? There may be an issue related to Postman (it is not saving token to global variables if the variable is not yet created). So your second request (bootstrap) doesn't contain this token. Another possible issue is your custom domain names and incorrect configuration for IdentityServer. In this case, you will find more info in logs. – vzaverugo Mar 27 '18 at 12:59
5

When you trigger GetToken command you should get SitecoreIdToken set to your global variables. This is done on 'Tests' tab via the following command

postman.setGlobalVariable("SitecoreIdToken", "Bearer " + jsonData.access_token);

You can check your variables by clicking 'Eye' icon next to environment. enter image description here

If the GetToken response is not saved to Global Variable, then you may need to create it with empty or dummy value and it will be automatically updated on your next GetToken call.

enter image description here

So you don't need to copy the token for each Postman script.

|improve this answer|||||
  • Even better solution than my quick fix in another answer. Thanks for describing further my last statement :) – Peter Procházka Mar 27 '18 at 14:49
0

I have found quick fix for my question.

1) You need to open "Collections" pane in Postman and open "Authentication" collection. Expand "Sitecore" section and click "GetToken". Click on blue "Send" button to get authorization token.

2) Copy the token to notepad and add "Bearer " before it. Something like this: enter image description here

3) In "Collections" pane, open "SitecoreCommerce_DevOps" collection. Expand "1 Environment Bootstrap" section and click "Bootstrap Sitecore Commerce".

Open "Headers" and put text generated in step 2 into Value column of "Authorization" key.

4) Everything will now work out :)

enter image description here

Best solution would be to create global variable "SitecoreIdToken" in Postman and set it with text generated in step 2. With this approach "SitecoreIdToken" will be always applied for any request...

|improve this answer|||||
  • any idea why i get this same error while installing sitecore commerce.BootStrapping Commerce Services: localhost:5005/commerceops/Bootstrap() Bearer Install-SitecoreConfiguration : The remote server returned an error: (401) Unauthorized. At C:\Program Files\WindowsPowerShell\Modules\SitecoreInstallFramework\1.1.0\Public\Install-SitecoreConfiguration.ps1:253 char:21 + & $entry.Task.Command @paramSet | Out-Default – Rama Krshna Ila Sep 13 '18 at 20:34
  • when i see in the logs i see the error "ERROR CtxMsg.Error.EntityNotFound: Text=Core.block.LoadEnvironment.EnvironmentCouldNotBeFound: Environment=HabitatShops" – Rama Krshna Ila Sep 13 '18 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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