How do I redirect a user to the page they initially came from before being prompted to login with Auth0? - redirect

I am using the Auth0 plugin on WordPress, and it seems that there is only one field in the settings to set the URL users are redirected to after logging in. However, I want to have them return to the page they were on prior to logging in (i.e., my WordPress site has multiple protected pages from which users are prompted to login with Auth0).
How do I make the redirect URL dynamic, or simply set it to the page they were previously on (the protected page)?
I've tried some redirect plugins but it seems that Auth0 always overrides them.
Any help would be greatly appreciated!

Solution can be found here: https://github.com/kevinvess/wp-force-login/issues/14
I installed the Force Login WordPress plugin (which protects all the pages on the site by default) and I whitelisted the homepage and pages I did not want protected with Auth0. Using the fix provided in the link above, I was able to get the redirect working.

Related

Does Akamai redirect pages based on cookie?

The website I am maintaining requires that users enter their age and country on a form before being able to access the contents on it.
This creates a cookie and the user doesn't need to go through the form again to access the pages on the website.
However, I need to create a page where the user is not required to go through this form even if the cookie doesn't exist.
After investigating, I found that AkamaiGhost is doing the redirection to the form if the cookie does not exist.
I tried to create the cookie automatically when the page loads, but Akamai still redirects the page before even allowing the page to create the cookie.
I am not very familiar with Akamai but I wish to know if Akamai can check for the cookies before redirecting the pages on the website. If so, how can I prevent this for this particular page?
Thank you for your help.
I contacted Akamai directly and the redirection was obviously being done by them. They solved my issue.

How to require user to login fb before accessing Facebook Canvas App webpapge directly?

I am new to Facebook App. I am developing my first Facebook Canvas App which links to a webpage hosting on my server.
I can now access the app by either:
(1) go to the Facebook App (http://apps.facebook.com/myappname), or
(2) directly access the webpage through URL(http://mywebsite.com/myapp).
I have set http://mywebsite.com/myapp as my canvas page in FB dashboard settings.
I want to avoid (2) by requiring user to login FB first before they can access the page. I would like to know how can I do that?
This may be a stupid question, but I have read the FB API documents (FB official guide talks a lot about setting custom login page) and searched through a lot of questions but they doesn't seem to fit what I need.
UPDATE:
I have tried something like putting the following in my webpage:
<script> top.location.href = 'http://apps.facebook.com/myappname'</script>
In this case, if user access the page by (1), there's no problem. If user access the page by (2), user will be redirected to Facebook.
However in the client side we can still view the content of the webpage even if user is not logging in to Facebook. I want to achieve this in the server side.
Thank you very much!
I have already solved the problem by using examples from Facebook PHP SDK version 3.
https://github.com/facebookarchive/facebook-php-sdk/blob/master/examples/example.php

Facebook login with multiple domains

I know that facebook allow me to specify multiple domains for my app.
But in the "Website with Facebook Login" i can only specify one url.
Is it possible for me, to authenticate users on domain.se, domain.dk and domain.net with the same App ? Or should i still create one app, for each domain ?
It is technically possible to use Facebook Connect on multiple domains, there are some limits (5 domains max).
So the key to doing this is adding all domains in the App Domain field under your app settings.
The PROBLEM, however, is that Facebook only lets you add domains that are derived from your Canvas URL or Site or Page tag URLs, so if you try to enter anything else you get an error that looks like this:
The SOLUTION is to create App on Facebook, Website, and Facebook Tab using the ADD PLATFORM button and then put in URLs that point to your other domains. Here is an example of what I mean:
If you use a unique domain for each field you can max out with 5 different domains. I have tested this technique with up to 3 domains, but i think it should work for all 5.
Note: Facebook admin features change from time to time, so all of this is subject to change
As long as you listed all the desired App Domains in application settings you should be able to authenticate users on any of them.
"Website with Facebook Login" is really only intended to be used as link to your site/application.
Update 2 (July 2016):
App domains must match the domain of the Secure Canvas URL, Mobile Site URL, Unity Binary URL, Site URL or Secure Page Tab URL.
Update (December 2013):
At the time of writing original answer it was possible to list any domains in application settings but from that time the UI of Application Settings (as well as way of handling Application Domains) changed at least couple of times, at some point you could only list domains that derive from one of application's canvas pages.
As of December 2013 it is possible (again) to list domains that do not derive from application canvas URL.
Assuming your domains are being served by the same web server and you have access to that web server, you can use the manual login procedure: https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow to login from as many domains as you wish.
Assume your domains are site1.com,site2.com.... Instead of using the Facebook javascript API, you will simply place a plain old Log In with Facebook button on each site which will redirect the browser to the facebook login page as described in the above article. In the state variable you can specify a code which indicates which of your sites is requesting a login. In the redirect you will use a single service domain which you assign to your web server (e.g. fb.mywebserver.com) and which you specify as the verified redirect url in the facebook login settings page. All the sites will redirect to this same url, avoiding the problem of supporting multiple domains.
Once the user has logged in, the browser will redirect to fb.mywebserver.com and pass it the state, which tells you which site is requesting login and a code which you can use on the back end to retrieve the user's info using the Facebook graph apis. You store this info with a uid in your data store then using the info in state, you redirect to to the appropriate site including a parameter that indicates a Facebook login (e.g. site1.com?fbc={some uid}). The browser will obediently then call site1.com?fbc... Your web server will receive this request and detect the fbc parameter which tells it to associate the corresponding Facebook logged in user with this site. It can then retrieve the logged in users info using the uid and, for example, return a session cookie for this user along with the page. If you generate the page on the server you can, of course, also include a welcome "user" or alternatively, your client code can do an ajax call to retrieve that information.
From the user's standpoint they press the Login with Facebook button, are redirected to a Facebook login page where they login and then are redirected back to your site in a logged in state. Not quite as nice as having the login popup but likely acceptable.
A similar process can be used for google logins as well
Best thing I've found to do in the development/production scenario is add a "Test App", then add a platform for your development web site - as you have to provide where the "page tab url" lives if you use that as a platform.
Facebook requires your "page url" to be live / accessible if you need to apply for status or permission review.
This got me around the "login in development" / "login in production" scenario.

Wrong redirect after login to confluence homepage in stead of my app (using crowd)

I have confluence, jira and my own developed jsf application connected to crowd. This enabled SSO over the three applications.
When not logged in and requesting a url deep inside confluence, I get redirected to the confluence login page. I do the login and I get redirected to the previously demanded page. This is good.
But when I call a url from my own developed application (and I'm not logged in) I get redirected to the confluence login page (thsi is correct) but afterwards I get redirected to the confluence home page in stead of the page (my app) I initially requested.
How can I get the same behaviour in my own app?
Added some explanation about the integration:
code to see if a valid crowd token exists
authenticated = HttpAuthenticatorFactory.getHttpAuthenticator().isAuthenticated(
(HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(),
(HttpServletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse());
Ok, I solved it. It was my app that redirecte to welcome page of confluence. So I added a os_destination= myself.

Looking for previous page redirect on Joomla CB login

Hey, I've been looking for a solution to this particular problem for a few days now with no luck. I'm working with Community Builder for a login page to a Joomla website. The site has some pages that require the user to be registered to have access to, and if they try to view the page without authentication they get redirected to the CB login page. The problem is that, after providing the proper login information, the user is sent to the index.php page. I'm trying to find something through code or plugin that'll allow me to redirect the user back to the page they are trying to view after logging in. Does anybody know of a method to implement this?
You can create a system plugin with event onAfterDispatch. Here you can check if user has access to the requested url (through joomla acl functions). If not then redirect the user to cb login page with additional query parameter return=base64_encode_url. It will set the hidden field named 'return' in login form and user will be redirected to that url after login.