Ok. Thanks @mehul. Then you only need that in the server, right?
If you expose the username/password on the state itās going to be sent to the client so thatās not a good idea. It will also be part of your git repository. Even if the repository is not public, thatās also not a good idea.
A common approach to add sensible data to an app is to use environment variables. You have a lot of info about how to do so in this topic: How to read Environment Variables
@vscopise I followed your example and it was very useful, now I have the token in the state variable, but I do not know how to use it, I mean is there a way to inject the token in frontity requests?
@vscopise I am working in this website which has multiple custom post statuses like āArchivedā, āPreviewā and so on. Those statuses are successfully created but to be able to render pages under those statuses I need a logged in user.
I tested REST API from postman and it works, but I am trying to use the token properly from frontity
So, for example in this link If I set the status to archived
I will not be able to render contents and I get 404 page (as it is now) but if I set it to Published I will see everything.
What I am trying to achieve is call that post (or any post) under the archived status with a token and being able to render contents
Hi @harvey,
I think that for a post to be displayed, its status must be āpublishedā, if the status is another, the content will not be able to be displayed.
I think you could change the state of the post (published, draft, privateā¦) using a token, knowing the ID of the post
I donāt understand the reason to change the status of the post, unless you want to work with private contentā¦
Yes, I want to render private content in the frontpage and I thought that I can request that content from frontity by adding the token somewhere, is there a way to always send the token if there is one available ?
@vscopise Yes, I tested what you mentioned and it worked from postman, but it is not working from frontity, I mean I have the auth var set in the place I think it should be but still getting the 404 error