Bring back the users to the same page after facebook login - cakephp

I am able to allow users to login using Facebook login API into my website, but every time they login, they go back to the homepage. I want the user to come back to the same page they where in when they login, not to go to the homepage.
Can anyone advise how this is done? I am using PHP SDK3.

Related

How to redirect to a new page when user is logged in Firebase?

please I am working on a project with Firebase authentication. The sign in functionality works perfectly. However I want to redirect the current login page to another page when user is logged in and back to the login page when user is logged out.

Remember specific site after authentication

I'm using the AuthProvider in react-admin with an OIDC solution. Everything works, except if users click on a specific site like myserver.com/cars/1 then they are redirected to login and after login, they will go to the start page instead of myserver.com/cars/1. How can I achieve that the AuthProvider remembers the original site?

Redirect to dashboard from home page based on user cookie

What I am trying to accomplish should be straight forward but since I have no experience in web development I would be more than happy to get some insights on best practices to accomplish user redirection from home page to dashboard if user is logged in.
Home page is a static WordPress site which is run in a docker container.
Dashboard is a single page application developed with AngularJS.
Nginx is used as a reverse proxy.
Authentication is basically a JWT. When user loggs in JWT is stored in Cookie.
If cookie is set user should be redirected to dashboard. Otherwise home page should be returned.
Should I configure Nginx to check for a cookie when accessing domain.com/ and redirect to app.domain.com if cookie exists?
what you are describing is a scenario where you need to go to home page and check whether User is Authenticated there, and redirect -before showing the homepage- if the user is authenticated from within the homepage code.

What is an ideal login workflow along with Facebook's OAuth2?

So today, I tried playing with Facebook's OAuth2 in my AngularJS application. I was able to make an activity work by clicking a Like button in my app. I'm also able to check if I'm logged in to Facebook using FB.getLoginStatus(). So my question is, if we currently have a login page, what is the ideal user experience when combining it with Facebook?
Do you display Facebook login page then goes back to your original login(this is what is happening on my application right now)
Do you display Facebook login page then once you've been logged in, bypass your original login page and allow the app to bring you directly to the main application. But how do I find out the facebook username that was used to log in?
any more ideas?

Custom login page in Java for GAE accounts

I have a Java application, and GAE application. Here is what I want to do:
I want GAE account users to authorize in my Java application, and I don't want to use "Sign In with..." solution. Instead I want the users to login from my Java application login page ( e.g providing username and password) and forward this login information to Google Servers.
In other words I want exactly this thing in this page. This webpage uses Google Accounts Service, but the login form, is a custom form that then (I imagine) forwards the data to Google Servers and then logs the user in.
How can I achieve that? What protocols should I use( OAuth, OpenID, GAE services... )?
You can't create a custom login page to Google Accounts. The whole purpose of Google-provided login page is that users trust the page when entering their password. Otherwise anybody could create a login page and start collecting users passwords.
If you need a managed/limited access to users account (with their consent), you should look into OAuth. But in any case this will not give you an option of making a custom login page.

Resources