override for oauthAutoConfig.plist for MPOAuthAPI

32 views
Skip to first unread message

Logan Allred

unread,
Mar 14, 2010, 11:48:16 AM3/14/10
to OAuth Objective-C
It seems to me that the only way to create an instance of MPOAuthAPI
successfully, is to have your service defined in
oauthAutoConfig.plist.

I can't find a straightforward way to provide these values in any
other way, other than to subclass several classes so I an override +
(Class)_authorizationMethodClassForURL:(NSURL *)inBaseURL
withConfiguration:(NSDictionary **)outConfig

Is this the intended behavior?

My service needs to have these values set dynamically as we have
several different environments to test against (localhost, dev,
staging, beta, production), and it seems silly to list these all in
the oauthAutoConfig.plist.

Any problem if I provide an alternate means of configuration, where I
can pass in a dictionary of the values instead of loading them from
the oauthAutoConfig.plist?

thanks,
Logan

Karl Adam

unread,
Mar 14, 2010, 5:06:42 PM3/14/10
to oauth-ob...@googlegroups.com, OAuth Objective-C
Actually oauthAutoConfig.plist only really exists to automatically
handle the authentication part or oauth. Initially it dealt with the
three endpoints needed to complete the oauth dance and now allows you
to specify a custom authorization scheme and the endpoints associated.

To do what you want, you can instantiate an MPOAuthAPI instance and
pass NO for autoStart:. Then you'd manually create an
MPOAuthAuthenticationMethodOAuth instance and set that as your
authenticationMethod. After setting that up, then you'd call
authenticate.

_Karl
Sent from my iPhone

> --
> You received this message because you are subscribed to the Google
> Groups "OAuth Objective-C" group.
> To post to this group, send email to oauth-ob...@googlegroups.com
> .
> To unsubscribe from this group, send email to oauth-objectiv...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/oauth-objective-c?hl=en
> .
>

Logan Allred

unread,
Mar 14, 2010, 8:04:00 PM3/14/10
to OAuth Objective-C
On Mar 14, 3:06 pm, Karl Adam <karla...@mac.com> wrote:
> To do what you want, you can instantiate an MPOAuthAPI instance and  
> pass NO for autoStart:. Then you'd manually create an  
> MPOAuthAuthenticationMethodOAuth instance and set that as your  
> authenticationMethod. After setting that up, then you'd call  
> authenticate.

I figured that's how it would work, but it asserts the configuration
during initialization:
*** Assertion failure in -[MPOAuthAuthenticationMethodOAuth
initWithAPI:forURL:withConfiguration:],
MPOAuthAuthenticationMethodOAuth.m:49

I'm doing this:
_oauthAPI = [[MPOAuthAPI alloc] initWithCredentials:credentials
authenticationURL:[NSURL URLWithString:baseURLString]
andBaseURL:[NSURL URLWithString:baseURLString]
autoStart:NO];
[_oauthAPI setSignatureScheme:MPOAuthSignatureSchemePlainText];
[(MPOAuthAuthenticationMethodOAuth *)[_oauthAPI
authenticationMethod] setDelegate:self];
[_oauthAPI authenticate];

But the assertion fails in the init method.

So there either needs to be a way to pass in the authorizationMethod
at init, or pass in the configuration at init, or the assertion needs
to be moved out of the init method of
MPOAuthAuthenticationMethodOAuth, or something else?

I can submit a patch, does one of these sound best to you?

Logan

Logan Allred

unread,
Apr 2, 2010, 9:02:46 AM4/2/10
to OAuth Objective-C
On Mar 14, 6:04 pm, Logan Allred <redb...@gmail.com> wrote:
> So there either needs to be a way to pass in the authorizationMethod
> at init, or pass in the configuration at init, or the assertion needs
> to be moved out of the init method of
> MPOAuthAuthenticationMethodOAuth, or something else?
>
> I can submit a patch, does one of these sound best to you?

I submitted a patch:
http://code.google.com/p/mpoauthconnection/issues/detail?id=31#c0

Reply all
Reply to author
Forward
0 new messages