How is OAuth 2 different from OAuth 1?

Eran Hammer-Lahav has done an excellent job in explaining the majority of the differences in his article Introducing OAuth 2.0. To summarize, here are the key differences: More OAuth Flows to allow better support for non-browser based applications. This is a main criticism against OAuth from client applications that were not browser based. For example, … Read more

How to extend access token validity since offline_access deprecation

Edit (August 14th 2012): A week ago the official Facebook PHP SDK was updated. The function name was changed to setExtendedAccessToken, and it was decided we actually needed to destroy the session afterwards, to remove the risk of having two active sessions. Also, the function no longer actually returns the token, but instead stores it … Read more

Refreshing OAuth token using Retrofit without modifying all calls

Please do not use Interceptors to deal with authentication. Currently, the best approach to handle authentication is to use the new Authenticator API, designed specifically for this purpose. OkHttp will automatically ask the Authenticator for credentials when a response is 401 Not Authorised retrying last failed request with them. public class TokenAuthenticator implements Authenticator { … Read more

Why Does OAuth v2 Have Both Access and Refresh Tokens?

The link to discussion, provided by Catchdave, has another valid point (original, dead link) made by Dick Hardt, which I believe is worth to be mentioned here in addition to what’s been written above: My recollection of refresh tokens was for security and revocation. <…> revocation: if the access token is self contained, authorization can … Read more