Can I run an application inside Facebook iFrame without logging in? - php

I am going through a discussion and I need to know if we can have users operate on a Facebook Page tab application without logging into Facebook? I don't want any user info, I don't need to know if they liked it or not. I just want them to be able to use my iFrame App without having to log into Facebook.
For eg: Log out of Facebook and go to this page: https://www.facebook.com/nissancanada/app_331500170235929. You can still work on it without having to log into Facebook. So, can I have a similar page for forms and submit options without having the user to log into Facebook?
PS: Don't ask what's the point of having this etc. It is a long thought idea. Just trying to find something on this.

yes you can (just like in the link you passed)... you don't need to do anything special... just don't ask for login and it will work.
though for some pages the properties of the page might prevent access to the page without active login so it is not depends on the application

Related

i want to login as an admin and as user in same browser in different tabs , how it is possible?

I am creating an app where I need functionality like this.
using role and permission in this app.
problem:
whenever the admin clicks on the logout button on their tab the user also logout from a different tab.
I try to fetch logged user details by using <Auth::user() in both, and it returns the same results,
and the result is that it only shows the admin details, not shows the user(role) details.
I tried to solve this issue using middleware and session but did not work, another way I tried to solve this using
multiple AUTH systems.
This might not be what you want, but if you are coding the login/authentication stuff yourself you can customise it as you like. You could put something like loginid=eytuuytytuytuytutytute on all the links and forms etc. so that your application knows what user login to associate with the session. This is probably ill advised though. It would be safer and easier to just toggle to another browser.

Wordpress - Need to direct users after logging in to different pages (based on the link they clicked)

Brace yourselves, this can get a little confusing. I have a wordpress website which currently directs users after logging in to their user dashboard. That functions exactly as we want it too on desktop and mobile/tablet devices.
Our website consists of different sections of course, to list a few examples we have 'Celeb News', 'Videos', 'Images', etc. Our website does not require logging in for any reason other than to 'Submit' content and have a 'Profile'.
Here's the DILEMMA. We have a Android app that is a wrapper of our website. In our APP we would like to force people to login in order to use the APP. We have limited functions in the platform we are creating this app with.
Here is how our URL structure is setup:
/wp-login.php
/wp-login.php?action=register
We want to be able to setup approx 5 different URLS that will direct the user to the desired page after logging in. I'm not a coder and the code I'm about to place below is wrong but I'm doing it for visual reasons for everyone to understand me better. We are looking for something like this:
https://example.com/wp-login.php?action=redirect_to"/index.php"
https://example.com/wp-login.php?action=redirect_to"/category/hottest/"
So we can place these links direclty on the buttons. When a user wants to access these sections on the app, they are asked to login. Once they login they are directed to the specified page or section. We also have cookies enabled in our login plugin so that if a user has logged in it will remember, we have our app setup so it can save these cookies to the devices. So we want the links to redirect the user to the desired page via the url if they are already logged in as well as the links on the buttons will be permanent.
Any help would be great!
All righty, so why not use the already built-in WordPress redirect, then?
If you build your login urls with the "redirect_to" parameter, the user should be automatically redirected once they have logged-in:
https://example.com/wp-login.php?redirect_to=%2Findex%2Ephp
Notice that you will have to url-encode the redirect value. How you do that, exactly, will depend on the language you are using, etc...
But basically, as soon as the user successfully logs in, in this case, she will be redirected to /index.php
Hope that helps!

Redirect authentication via OAuth2 to Google login page

I created a web app that allows users to connect their google calendar using OAuth2. And so far everything is working the way I've wanted it to be. Now my concern is, when a user clicks the link to authenticate his account, I want it to forcefully redirect to the google login page. Right now, when he clicks the link and his google account has an on-going session in that specific browser, the login page no longer appears. Is there a way to do that? Thanks.
If you set the parameter approval_prompt to force, you should be able to forcefully show the auth screen every time. More details about this parameter are documented here.
the only way to do that is to force a full logout from that client (browser, app, etc). You can do that by using:
https://www.google.com/accounts/Logout?continue=https://appengine.google.com/_ah/logout?continue= and add the redirect as "continue" parameter.
This will logout from everywhere so the user might not be happy if he/she didn't do that on purpose.
I would go with asking for permissions again if you want to make the users "feel" like they are actually login into your app again (i assume that why you want this approach).
Google also has a "switch user" option, but I haven't use it and it's really hard to know if the user will be asked for user and pass or the user will be automatically authenticated because he/she is already logged in another tab in the browser.

How to redirect user to different site?

I have a wordpress site, and I want to put a link on that site so that users are redirected to another PHP site.
But here the problem is that the other php site uses authentication, i.e. users need to give username and password before they can enter.
I want to develop a link that users can simply click on and get to the other site directly.
I can give the username and password for the php site, but the requirement is that the user users are not asked for username and password.
you have to make a new php file(in the 'php site') that assign the session variable to the linked users, and then it redirect them to the main page of the 'php site'
U have to write an authentication function on the other php site.. when the user clicks on the link of the wordpress site redirect him to that authentication function, along with his credentials, where the users will get logged in automatically and get redirected to your php site.
if i get you right, i think the best way is to generate the link in wordpress site with a parameter : http://www.linktophpsite.com/?autologin=true
Then at php site you could get the element and if it is set to true, you can log the user to your site. If you want single sign-on on both sites, that's totally different. I recommend you to read articles about single sgn-on on php
If you have no control over the target site, then your options are very limited. You can't just provide access to material that requires login credentials without providing those login credentials.
Your best, and most secure, bet is to include the target site's login fields directly from their site in an iframe. The user logs into the other site, you track the iframe onload event to see that it changed, and then redirect the user to the page in question. This is better because it keeps you from handling the login details directly on your site.
I cannot guarantee that this works as simple as that, I haven't tried it and this page seems to indicate that at least some of the possibilities with cross-domain iframes are no longer relevant with modern browsers (I didn't read the page in detail, just trying to give a starting point).

Find out if you are logged in to Facebook (not app) - php sdk

I downloaded the Facebook-sdk for php and played around with it for a while.
So they have this example file, where user info is showed:
facebook-facebook-php-sdk-98f2be1/examples/example.php
It only shows user info after accepting the app.
Maybe that's not even possible/allowed...
But I what to know if a user is logged into facebook, not into my app.
I don't need his name, id, etc, nothing... Just want to know IF he there is a Facebook session in the background. Reason: I want to redirect users who are not logged in to Facebook elsewhere, because maybe they don't even have a facebook account.
But I w[an]t to know if a user is logged into facebook, not into my app. […] Just want to know IF he there is a Facebook session in the background.
That’s not possible.
Without having a user connect to our app first, you get virtually nothing, no info whatsoever.
Update:
The PHP SDK now has a method getLoginStatusUrl that can provide that info.
It can determine three different states – a user logged into Facebook, logged out of Facebook, or unknown. It works by redirecting the user’s browser to Facebook to make the check, and then redirecting to three different URLs of your app that you can specify.
(Of course this’ll work without using the PHP SDK as well – you will just have to look into it’s source to see what the exact URL it creates is, then you can redirect the user there yourself.)

Categories