Movatterモバイル変換


[0]ホーム

URL:


Dev guideRecipesAPI ReferenceChangelog
Dev guideRecipesUser GuidesNuGetDev CommunityOptimizely AcademySubmit a ticketLog InCross-platform products
Dev guide
All
Pages
Start typing to search…

Basic authentication from backend

How to use basic authentication of Optimizely CMS.

Prerequisites

  • Optimizely CMS
  • Optimizely Graph addon (only PaaS)
  • Postman or cURL

CMS configuration

Setup (PaaS only)

  1. Open your Optimizely CMS solution and install theOptimizely ContentGraph addon.
dotnet add Optimizely.ContentGraph.Cms
  1. Update theappsetting.json file. (You should get this information from the Optimizely Support team).
"Optimizely": {    "ContentGraph": {      "GatewayAddress": "",      "AppKey": "",      "Secret": "",      "SingleKey": "",      "AllowSendingLog": "true",      "ContentVersionSyncMode": "All",      "SyncReferencingContents": "true",      "EnablePreviewTokens": "true"    }  },

Config

  1. Set access rights for contents
  1. Run the website and run theOptimizely Graph content synchronization job.

Retrieve restricted content

Postman

  1. Importhttps://cg.optimizely.com/app/swagger/swagger.json to a Postman collection.
  2. Set up variables for the collection:
    • baseUrlhttps://cg.optimizely.com.
    • appKeyAppKey value (same as above).
    • appSecretSecret value (same as above).
  1. Configure theAuthentication method, for simplicity, it should beBasic, and put yourappKey asUsername andappSecret asPassword.
  1. Start query restricted content items with headers:cg-username andcg-roles:
📘

Note

  • cg-username – Optimizely CMS user.
  • cg-roles – Optimizely CMS roles to access specific content items.

cURL

curl \  --request POST \  --user "$appKey:$secret" \  --header "Content-Type: application/json" \  --header "cg-roles: Everyone,Content Admins,Administrators" \  --header "cg-username: admin" \  --data '{"query":"{\n    Content {\n        items {\n            Name\n            Status\n        }\n    }\n}","variables":{}}' \  https://cg.optimizely.com/content/v2

Updated 2 months ago



[8]ページ先頭

©2009-2025 Movatter.jp