how to logout with django-social-auth? - django-socialauth

I'm planning to integrate facebook and google login into my site.
How do I logout of facebook or google session ?
I tried to use the view below -
from django.contrib.auth import logout
def logout_view(request):
logout(request)
# Redirect to a success page.
After logout (using the above view), I'm still able to login (without password) into facebook/google from another browser tab.

Related

Facebook Recent Logins breaks OAuth flow

I'm having troubles working with what appears to be an error with Facebook's OAuth server-side flow. When logging into Facebook using "Recent Logins", Facebook does not redirect back to my calling application. Instead it goes directly to the Facebook home page.
If I login to Facebook using the email/password fields at the top right of the screen, then the redirection becomes successful.
Is there some way to force facebook to send users to it's main login page and not this main page that displays the recent logins when they are not already logged into Facebook?
This also occurs using Facebook's very own OAuth for developers. So I know it can't be just me.
Login to Facebook.com
Logout
Visit facebook's apps page
Click your profile pic and enter your password (rather than using the blue banner to login).
Facebook redirects you to their home page rather than this page
What would be great is a parameter to this page that would allow me to force a particular facebook login dialog as a workaround.

Laravel Social Authentication Without Reloading Client Application(website)

I have a Workflow application(website) using canjs. The various steps(pages) are preloaded. A user is allowed to explore the app without login. However if the user wishes to save the workflow, they must login. Alternatively the user can login at any of the steps in the workflow.
The application has a provision for users to login using Facebook and Twitter.
The backend consists of Laravel and Socialitelinkpackage take care of the login process.
As Facebook and Twitter use OAUTH the login work flow is as follows :
Client calls a login init route.
The route redirects to a login page of the social login provider(FB or twitter)
User Authenticates/Authorises your app
The user is redirected to a success route (say /success_callback) on your app. At this point we can use Socialite package to get the user information.
The issue I'm facing is that I don't want to reload the APP on the client browser. So how to inform the client from /success_callback if the user has logged in or not, etc.

scribe with gwt- trying to go to twitter for auth and then come back to my gwt app

What I am trying to do is this--
(1) User comes to app.html (GWT application) in my website- here he sees many options to login with- like Facebook, Twitter Google Yahoo etc
(2) When he clicks on Twitter (for our example) he is redirected to the twitter site where he authenticates + allows my web app to access his twitter data.
(3) Finally user is redirected via OAuth Call back URL to my site... Here the oauth token and oauth verifier are part of the callback url as parameters... These are now extracted and finally the access token is obtained.
Is such a flow possible? Or do I necessarily have to open twitter auth url in a new window of browser?

Facebook connect silent logout along with my logout url?

I have created a facebook connect login script in addition to the custom login script my site uses, which records FB user id and stores in my DB. It uses facebbok.php scripts provided by facebook and JS based popup login dialog (oauth).
I just authenticate user from FB account and do my own cookie based login on the basis of matched fb user id.
Now the problem is I can get logout url from php using getLogoutUrl() but how to logout silently without changing url in address bar using my logout.php? I tried destroySession() but it didnt logout fb user.
If user dont logout using getLogoutUrl() then next time when some other loggedin FB user tries to use fbconnect login the FB dialog box gives error "An error occurred. Please try later". Then I have go back to IE and logout that FB user from there and it works.
You can't "silently" logout a user using Facebook API. What you can do is test if the user is logged using getLoginStatus

Facebook logout problem

I am using Facebook Login button in my website.
Visitors can log in via facebook successfully.
FB login is working integrated with my own membership.
I mean I keep logs of FB logins.
The problem is here;
User may log out from my site by clicking Logout button (my own logout button)
When they press the logout button, i redirect them to logout.php and run the following JS;
"FB.logout()"
The JS code causes that user logout from their facebook account not my site.
If they login facebook on an another tab, and refresh my page they will log in again.
How can i end a session that user open via Facebook on my site?
You also have to clear facebook sessions from your machine with below code:
using Facebook;
Thread.Sleep(1000); // delay is required to get it work
Facebook.Session.ConnectSession cn = new Facebook.Session.ConnectSession(ConfigurationManager.AppSettings["APIKey"].ToString(), ConfigurationManager.AppSettings["Secret"].ToString());
cn.Logout();