Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logout link with return URL (OAuth)

My application is integrated with Facebook, Google and Microsoft (using OAuth).

To logout from facebook I'm using the following URL:

https://www.facebook.com/logout.php?next=[YourAppURL]&access_token=[ValidAccessToken]

Is there something similar for Google and for Microsoft?

For Google I tried:

https://accounts.google.com/Logout?continue=http://localhost:51820

But it didn't work... It returns: The page you requested is invalid.

How can I get that URL logout?

like image 513
amp Avatar asked Jun 11 '13 17:06

amp


1 Answers

I finally got the right links:

  • Facebook:

https://www.facebook.com/logout.php?next=[YourAppURL]&access_token=[ValidAccessToken]

Source: A Working Facebook OAuth Logout URL

  • Google:

https://www.google.com/accounts/Logout?continue=https://appengine.google.com/_ah/logout?continue=[http://www.mysite.com]

Source: google account logout and redirect

  • Microsoft:

https://login.live.com/oauth20_logout.srf?client_id=[CLIENT_ID]&redirect_uri=[REDIRECT_URL]

Source: Server-side scenarios

Those links can be use like that in JavaScript:

function logout (){
document.location.href = "https://www.facebook.com/logout.php?next=[YourAppURL]&access_token=[ValidAccessToken]";
}

Suggestion to implement this: Logout from external login service (Gmail, facebook) using oauth

like image 109
amp Avatar answered Oct 12 '22 12:10

amp