Skip to content

Commit f816580

Browse files
committed
improved authorization handling
1 parent d5b9a12 commit f816580

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

docs/personalization/enable_personalization.md

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -160,25 +160,35 @@ Place the following code snippet in the `<head>` section of your header template
160160
### Check whether the bundle provides REST data
161161

162162
You can verify the import controller of the bundle by calling the local API.
163-
Use the `Accept` header; you may need to add an `Authorization` header if authentication is required.
163+
As the API uses token based authorization you first need a valid bearer token.
164+
165+
When you publish a Content Item a bearer token will be created and saved to the ibexa_token db table.
166+
167+
Additionally a POST request is send to the Personalization Engine, containing the token
168+
and the Rest URL where the Personalization Engine can fetch the changed Content.
169+
170+
The BEARER_TOKEN will be the newest one in `ibexa_token` table having `type=1` and `identifier=update`. The token will by default be valid for 1 day.
171+
172+
You can use this token to check what is provided to the Personalization Engine:
164173

165-
To check whether the `content` endpoint is working as expected, perform the following request:
166174

167175
```
168-
GET http://<yourdomain>/api/ibexa/v2/personalization/v1/content/{contentId}
169-
Accept application/vnd.ibexa.api.Content+json
170-
Authorization Basic xxxxxxxx
176+
curl --location '{PERSONALIZATION_HOST_URI}/api/ibexa/v2/personalization/v1/content/id/{contentId}?lang={comma_separated_languages}' \
177+
--header 'Accept: application/vnd.ibexa.api.Content+json' \
178+
--header 'Authorization: Bearer {BEARER_TOKEN}'
171179
```
172180

173-
Additionally, check whether the `contenttypes` endpoint is working with the following request:
181+
Additionally, check whether the `contentlist` endpoint is working with the following request:
174182

175183
```
176-
GET http://<yourdomain>/api/ibexa/v2/personalization/v1/contenttypes/38?page=1&page_size=10
177-
Accept application/vnd.ibexa.api.Content+json
178-
Authorization Basic xxxxxxxx
184+
185+
curl --location '{PERSONALIZATION_HOST_URI}/api/ibexa/v2/personalization/v1/contentlist/{comma_separated_content_ids}?lang={comma_separated_languages}' \
186+
--header 'Accept: application/vnd.ibexa.api.ContentList+json' \
187+
--header 'AUTHORIZATION: Bearer {BEARER_TOKEN}'
188+
179189
```
180190

181-
The `content` endpoint returns one item and the `contenttypes` endpoint returns many.
191+
The `content` endpoint returns one item and the `contentlist` endpoint returns many.
182192

183193
``` json
184194
{
@@ -227,18 +237,7 @@ To get recommendations you must first export the item information to the Persona
227237
After you [define item types to be tracked and recommended](#set-up-item-type-tracking),
228238
start the full export.
229239

230-
You do it with the `ibexa:personalization:run-export` command.
231-
232-
If your installation hosts only one SiteAccess, run the following command to export your data:
233-
234-
``` bash
235-
php bin/console ibexa:personalization:run-export
236-
--item-type-identifier-list=<item_type>,<item_type>
237-
--languages=<language>,<language>
238-
```
239-
240-
If your installation hosts multiple SiteAccesses with different customer IDs,
241-
you must run the export separately for each of the `<site_access_name>`/`<customer_id>` pairs.
240+
You need to run the `ibexa:personalization:run-export command per SiteAccesses that you want to use together with Personalization. Please note that you need different customer IDs for different SiteAccesses.
242241

243242
``` bash
244243
php bin/console ibexa:personalization:run-export

0 commit comments

Comments
 (0)