bloomreach / spa-sdk

Apache License 2.0
17 stars 14 forks source link

Token is removed when URL rewriter is applied #19

Open leroyvandijk opened 1 year ago

leroyvandijk commented 1 year ago

Hi Bloomreach team,

We use the URL rewriter to rewrite articles for our website from example /articles/2023/06/other-test to /articles/other-test.

Now when in the experience manager, I want to go to the live preview it first shows me the page: http://localhost:3000/articles/2023/06/other-test?token=THEWHOLEJWTTOKEN&endpoint=http://localhost:8080/site/resourceapi which gives a 301 and redirects me to this page: http://localhost:3000/articles/other-test?endpoint=http%3A%2F%2Flocalhost%3A8080%2Fsite%2Fresourceapi

image

As you can see the token is stripped away, which causes the user not to see the edit buttons on the preview page. Since there is an issue with the experience manager not giving the correct url, the user can edit the pages only through Content -> Documents -> Articles -> Test Article and then the View -> Website button. We currently do not have a solution to fix this, so we thought maybe the frontend app can be adjusted so it actually can pass the token.

I've tested the issue with changing the 'authorizationQueryParameter' in the configuration to something like 'blabla'. Then the token is NOT stripped away anymore, but of course the preview doesn't work anymore.

Is there a way so we can pass the token after the redirect?

Kind regards, Leroy

joerideg commented 1 year ago

Hi @leroyvandijk , Could you please share with us some additional info on your setup.

I'll ask within the team if anyone has some idea's on how to solve your problem or at least provide a workaround.

beetlerom commented 1 year ago

@leroyvandijk Any updates on this, we need the info to be able to look into your issue?

leroyvandijk commented 1 year ago

What version of Content are you using, SaaS or PaaS, and if PaaS what version? PaaS, 15.2.3 What version of the SDK are you using? 21.0.0 The 'Url rewriter' you mention is that a bloomreach supported plugin? Yes Is that just for the CKEditor or also for other links? The token is only used for the experience manager, but yes all the links that come with the url rewriter.

I've created a workaround that picks up the token from the Authorization header en put that as a query param in the redirect

joerideg commented 1 year ago

Ok thanks @leroyvandijk , I'll discuss it with someone internal that has the knowledge on how the url rewriting works in the backend for the experience manager preview and get back to you.