Exiting Link with Return URL (OAuth)

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

To exit facebook, I use 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 that did not work ... It returns: The page you requested is invalid.

How can I get this output from the protocol?

+6
source share
2 answers

I finally got the correct links:

  • Facebook:

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

Source: OAuth Facebook Work Output URL

  • Google

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

Source: google logout and redirect

  • Microsoft:

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

Source: Server Scripts

These links can be used as in JavaScript:

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

Recommendation: Exiting an external login service (Gmail, facebook) using oauth

+17
source

You do not have to register a user outside of Facebook, Google, etc. You just need to get them out of the application. By redirecting them to accounts.google.com/Logout , you are actually registering the user from your Google account, which means that if they also opened Gmail in a different tab (say), they will also be logged out. Similarly, if you redirect them to www.facebook.com/logout.php , you are in fact unloading them from Facebook, which means that if they opened Facebook on a different tab, they would also be disabled.

Instead, all you have to do when a user exits your application is to β€œforget” OAuth tokens.

+3
source

Source: https://habr.com/ru/post/947043/


All Articles