When I try to access my ReactJS website to different browser, then it's not working. Need to login Payload admin portal, then its working fine.
How can I access my website without passing any credentials or login in different browser.
I'm using the payload:1.6.32 version.
@Yogesh Good morning! This is likely happening because you are not bringing the cookie stored upon a sucessful login with you to the other browser
You would have to somehow bring the cookie over to maintain your session as far as I know
I can imagine some workarounds in my head, but not sure what your end goal is
On your collection you can set the
access
object to allow read by any one i.e.
access: {
read: true,
}
The
template-website
repo on the payload github has some examples of this along with a helper.
Oh I thought they meant they weren't staying logged in
Yeah, this is an access control issue then
@kariyngva Doesn't read need to be a function that returns true?
access: {
read: () => true
}
yeah that's right
First of all thanks to all
How I can access my website without login.
Or how I can provide the public access, so anyone can be access
I used this already, it's working only logged in user which we have gave to access
I'm afraid I don't follow what it is exactly you want to do.
I'm creating the public website, anyone can access
yeah, how are you reading the data from Payload? REST api, graphql or local?
REST api
if you have the collection set up like so you shouldn't need authentication 🤷♂️
access: {
read: () => true
}
I used, but it is not working
make sure you add read access control like the above to each of your collections that you need to retrieve as an unauthenticated user
this is 100% the issue as reported above
Yes sure, I will check that way. Thanks a lot
Hi @jmikrut Good morning, I used this way but it is not working
please check below screenshot
This is my payload.config.ts file
Could you help me on that?
@Yogesh Nothing seems odd in those SS
Which part is not working?
Setting the "read" access control should have made the collection publicly accessible
In addition, since you have an upload field, I think you also need to set the access control on your Media Collection, assuming that content should also be publicly visible
Thanks a lot guys 🙏
I missed the provide access to media collection. Now it is working
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.