I have read Facebook documentation and it says that FB.logout is used to log the user out of both web application and Facebook. I have made a website on which I use FB.logout() but I want only the session of the user to be revoked not log the user out of the Faceboook.
I have seen this thing been done on many other websites looking at their code I find they are also using code like
function fb_logout(){
FB.logout(function(response) {
console.log('loggedout');
});
}
I also tried using this function but I still log my users out of Facebook too.
Is there a way to accomplish this task?
You can just delete all the data you have on user and show them login button again (mimicking logout from your app) without calling "FB.logout" function(it logs user out of facebook too). This will behave as per your needs, once user clicks on the login button again, you will again get the data without him needing to login to facebook again.
Related
When the user authenticateswith the "sign in" with google button with javascript the user is redirected into my webapp basedon the successful return. I pass the id-token to the backend and use $client->verifyIdToken($id_token); to fetch and can get the userid ('sub'). Great!
When the user wants to logout, I need to kill the session on the backend so I have a page /logout that logs the user out and then redirects to the top page. However, the top page javascript login box still indicates that the user is signed in and triggers a sign in and gets redirected back into the webapp which is bad. If the user has logged out, I want them to have to click the Google "Sign in" button again and have it run automatically.
I've looked through all the documentation I can find for the PHP backend and I can't seem to find any way to log the user out of my app. I've even tried calling $client->revokeToken(); on the backend on the logout page but it has no effect.
Is there anyway to logout the Google user from my app on the backend or am I forced to detect if the user is logged in, call this javascript first and then proceed to my logout page?
<script>
function signOut() {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function () {
console.log('User signed out.');
});
}
</script>
It would seem to me that there should be a logout from google (or revoke the current session in webapp (token?) ) from the backend but I can't find it for the life of me.
Google does not allow for third party logout. That being said your application can not log a user out of Google. If they allowed that then your app could also log me out of Stack overflow and every other third party website that i have logged in using my Google account.
What you need to do is remove the login to your own site by removing the cookie that was probably set somewhere.
I have a simple web app where users can login via Facebook to CRUD objects (and show them on a map).
I successfully implemented the login and logout functions using the full example code from Facebook documentation, but the user doesn't stay logged in.
When I log in, I'm able to display the my Facebook Surname and Name, but when I refresh or go to the next page of my app, the Facebook API tells me that I'm not connected (anymore) and thus I have to reconnect.
The same happens with the full example code. On page refresh: you have to login again.
Am I missing something here ?
That was pretty dumb but my browser (chrome) was blocking cookies from facebook.com on my website, so I couldn't stay logged.
Resolved the problem by authorizing facebook.com cookies on my website.
i have a project that have option to log in with facebook.
but this option only work for the admin of the site
whenever any other user want to log in the site a form will appear and ask some info. if full fill the form and click register it shows a error message.
Now i want to remove the form part from the website and want onclick login for all user. here is the link of the site
https://dev.metarank.com/
please help me to find the solution
thanks in advance
If I am not wrong to create a Facebook login button you need to create an app to obtain api keys, right?
If it is the case the problem could be the following:
After testing the login button you have to make the app publicly available by passing a review process from Facebook, and then anyone will be able to login to your website with a Facebook account.
As said: this is the process for standard apps, at the moment I am not sure at all about if it is exactly the same process for logins.
I am following authentications steps for AMS as described here:
http://azure.microsoft.com/en-us/documentation/articles/mobile-services-html-how-to-use-client-library/#caching
From Kendo UI mobile app (Javascript)
I can log in using Google as an authentication provider using client.login("google"), execute authenticated AMS custom API calls
and also doing client.Logout() via button, that seems to successfully disconnect me from AMS
On subsequent client.login(), however, I do not get the Google account login window. It is seemingly stored in a cookie and the user is logged in automatically, thus not giving me a chance to log in as another user.
I was wondering what additional actions besides client.Logout() I must do to initiate the Google login screen on the next session after the user decided to logout. I do not want to force the user out of his Google account, as this would be impolite, just log him out of my application.
I know this question is old, but since it is not answered and I found it out recently I decided to post the answer here.
When you go to google.com you can add another account (top right icon). After that you can choose after each logout which account you want to use for your application to login. And you can even add other accounts to log in.
I am building a very small webpage to use in a kiosk stand. The goal is to let people "Like" a facebook page on location with a touchscreen.
Users have to login first to like a page, so Facebook will come up with their regular Login popup, which works like a charm. When the user logged in, the page is liked (since they clicked the "Like"-button) and the user should be logged out again (since no-one wants to be logged in on a public computer). The page should reload after that.
Now this is possible with the Javascript API from Facebook. They have an event listener that calls a function when a user likes a page. I just have to call FB.logout() when that event triggers :) .
Unfortunatly, it isn't working for me. I could be very dumb, or the Facebook API is bugged.
My code:
window.fbAsyncInit = function() {
FB.Event.subscribe('edge.create', function(response) {
FB.logout(function(response) {
window.location.reload();
});
});
}
But this doesn't work, and I think the problem lies in the Login part from Facebook.
Does anyone has any experience with this? It should be very simple, but I can't get it to work...
Some things I have tried:
Prompt a normal login - Possible, but it says that my app needs access to some information. Really the only thing I want to do is get users to like a page.
setTimeout loop - Tried this, but the Facebook Login seems to stop Javascript as a whole on my page?
EDIT: I know that it is a bad idea for people to insert their credentials into a public computer, but the customer wants it this way. There is also a QR-code which links to the Facebook page, but that doesn't solve my problem :) .
TL;DR: Facebook Javascript callback from the "Like"-button works when a user is Logged in, but fails when a user has to log-in via the Facebook pop-up.
Unfortunatly, it isn't working for me. I could be very dumb, or the Facebook API is bugged.
Nope. The problem lies in your approach, resp. the concept.
FB.logout only works with an active access token (since otherwise, any site I visit on the net could log me out of Facebook, and that would be hugely annoying).
But since the user does not connect to your app, you don’t have an access token.
Prompt a normal login - Possible, but it says that my app needs access to some information.
That is the only way you will get an access token, and since the only way you can use FB.logout.
(And if the user logs in to Facebook, but then denies connecting to your app, again you will not have an access token, so you can’t log them out in that case either.)