Nico113 / mpoauthconnection

Automatically exported from code.google.com/p/mpoauthconnection
0 stars 0 forks source link

OAuthAPI should set isAuthenticaed=YES when it restores an unexpired access token #34

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

If you have an empty keychain and go through the authentication process, the 
MPOAuthAPI object's authenticationState is set to "authenticated" and 
isAuthenticated returns YES.

However, if you have an unexpired access token stored in the keychain and the 
library doesn't do the whole OAuth process, it is left with autheticationState 
set to "unauthenticated" and isAuthenticated set to NO, even though it has an 
access token.

What is the expected output? What do you see instead?

I would expect isAuthenticated to correctly represent the state of the API 
library, regardless of whether the access_token is newly received or cached. 
Otherwise, it's somewhat difficult to know when the client is properly 
authenticated: for new or refreshed tokens, we can listen for the appropriate 
NSNotifications, but for saved tokens, there is no indication, short of 
duplicating the credential existence and expiration check, which I feel should 
be abstracted outside of the client.

What version of the product are you using? On what operating system?

Latest release from SVN repo on iOS 4.

Please provide any additional information below.

Original issue reported on code.google.com by Jon.Trau...@gmail.com on 28 Jun 2010 at 11:18

GoogleCodeExporter commented 9 years ago
Ah, it's a bug. I was wondering why isAuthenticated didn't work. 

I added 
  [self.oauthAPI setAuthenticationState:MPOAuthAuthenticationStateAuthenticated];

in the authenticate method of MPOAuthAuthenticationMethodOAuth.m, but I 
consider that a hack and not a proper solution.

Original comment by axe...@gmail.com on 19 Dec 2010 at 7:13