You need to sign in to do that
Don't have an account?
Andries.Neyens
Login using javascript remoting
Hi all,
we are trying to use AngularJS as a community site.
Problem is that the first page is accessible as a guest user.
All remote action calls are public.
At a certain point, the calls must be made protected (via profile and apex class security)
Here we want to use some sort of login via remote actions using Site.Login
But helas, this is not working.
Session id's returned are still for guest users (but login was successful, can be seen in the login history)
Only way to let this work is use the standard login page that somehow sets session id's via cookies?
no idea how to mimic this ??
andries
we are trying to use AngularJS as a community site.
Problem is that the first page is accessible as a guest user.
All remote action calls are public.
At a certain point, the calls must be made protected (via profile and apex class security)
Here we want to use some sort of login via remote actions using Site.Login
But helas, this is not working.
Session id's returned are still for guest users (but login was successful, can be seen in the login history)
Only way to let this work is use the standard login page that somehow sets session id's via cookies?
no idea how to mimic this ??
andries
I'm having the same issue. Have you got this resolved? If so, could you please share the solution?
cheers
Shiran
we did solve it! The key tip is:
Visualforce.remoting.oauthAccessToken = <access_token>;
(https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_js_remoting_oauth.htm)
You can use oAuth to retrieve the token. We did that in a new popup window with a callback to a page with some javascript to pass it back to the parent.
Of course, all remote actions should be publicly accessible. And in code you can check on access (we did that on profile, Guest user vs Community user)
Thanks for the reply. I managed to resolve this with a different workaround.
Cheers,
Shiran
Actually I gave up the VF remoting method since the sychronous(direct apex controller method) call worked just fine. What I wanted to do was register a new community user and log him in a single action. That worked fine.
Cheers,
Shiran