0

We have a lightning community, as well as a VF community that holds a cloudcraze/B2B commerce storefront. Within the lightning community we are calling cloudcraze APIs for things like user registration.

Currently, we are successfully registering users (by calling the cloudcraze user registration API). Immediately after registering a user successfully, we call the Site.login() method to log the user into the community. Both registration and login are successful - we have confirmed this through debug logs and by checking the login history of the org to see that those users have logged into the proper community.

Unfortunately, we are facing a weird problem where the current user doesn't seem to change. Using debug logs, we see that the current user is the same both before registration + login and after (it's the community guest user).

If we log in through Salesforce by going to a contact and clicking "Log into community as user", Salesforce correctly recognizes the current user.

Ashley
  • 1
  • 1
  • Site.login returns a page reference. Don't you have to respect that? use the URL from it and redirect user to this place and then the cookies will get fixed (session id will get saved to cookie etc). You can also check the components and VF pages that came with community, there should be examples for custom login page, check how they work? – eyescream Jun 18 '20 at 23:37
  • 1
    Thanks - yeah, if I use the returned page reference and redirect to it, login works as expected. What I’m trying to do is avoid the redirect and remain on the same page, but be logged in. – Ashley Jun 20 '20 at 01:52

0 Answers0