I'm relatively new to Objective-C and am completely new to xAuth. Can somebody show me how or lead me to a tutorial to get a request access token pair and make a request to a URL given username
, password
, consumer_key
, and consumer_secret
?
我对Objective-C比较陌生,对豪斯完全陌生。有人能告诉我如何获取请求访问令牌对并对给定的用户名、密码、consumer_key和consumer_secret的URL发出请求吗?
I'm really foggy with this, and I don't even know why I get a access token pair (why two tokens, and how to both of them come into play?). Also, I already looked through a bunch of tutorials, but all of the good ones are for Twitter, and use some kind of Twitter engine. (I'm using xAuth for Foursquare, and their documentation can be found here.)
我对此非常困惑,我甚至不知道为什么我得到了一个访问令牌对(为什么两个令牌,以及它们如何发挥作用?)另外,我已经浏览了一些教程,但是所有好的教程都是针对Twitter的,并使用某种Twitter引擎。(我把xAuth用于Foursquare,他们的文档可以在这里找到。)
Thanks!
谢谢!
1 个解决方案
#1
4
MGTwitterEngine is a great place for example code. You can use the OAuthConsumer project to help making xAuth calls.
MGTwitterEngine是一个很好的地方,例如代码。您可以使用OAuthConsumer项目来帮助进行xAuth调用。
If you checkout MGTwitterEngine.m (shown on Github) you can see in the function
如果你付款MGTwitterEngine。m(显示在Github上)可以在函数中看到
- (NSString *)getXAuthAccessTokenForUsername:(NSString *)username password:(NSString *)password
- (NSString *) getxauthaccesstokenforcement username:(NSString *)用户名密码:(NSString *)密码
creates an OAConsumer
object with consumerKey and Secret and then creates an OAMutableURLRequest
object, you'd use Foursquare's info there.
创建一个带有consumerKey和Secret的OAConsumer对象,然后创建一个OAMutableURLRequest对象,您将在那里使用Foursquare的信息。
You should then be able to create a NSURLConnection
with that request and then get your results in your standard delegate method, a la URL Loading System
然后,您应该能够使用该请求创建一个NSURLConnection,然后在标准委托方法(la URL加载系统)中获取结果
#1
4
MGTwitterEngine is a great place for example code. You can use the OAuthConsumer project to help making xAuth calls.
MGTwitterEngine是一个很好的地方,例如代码。您可以使用OAuthConsumer项目来帮助进行xAuth调用。
If you checkout MGTwitterEngine.m (shown on Github) you can see in the function
如果你付款MGTwitterEngine。m(显示在Github上)可以在函数中看到
- (NSString *)getXAuthAccessTokenForUsername:(NSString *)username password:(NSString *)password
- (NSString *) getxauthaccesstokenforcement username:(NSString *)用户名密码:(NSString *)密码
creates an OAConsumer
object with consumerKey and Secret and then creates an OAMutableURLRequest
object, you'd use Foursquare's info there.
创建一个带有consumerKey和Secret的OAConsumer对象,然后创建一个OAMutableURLRequest对象,您将在那里使用Foursquare的信息。
You should then be able to create a NSURLConnection
with that request and then get your results in your standard delegate method, a la URL Loading System
然后,您应该能够使用该请求创建一个NSURLConnection,然后在标准委托方法(la URL加载系统)中获取结果