如何正确使用Oauth [英] How to use Oauth properly

查看:114
本文介绍了如何正确使用Oauth的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有取得多大进展,所以请寻找原始问题中所述错误的答案,我认为我的问题最好通过一些关于如何正确使用Oauth的整体说明来解决。请看下面重新提出的问题。






原始问题



我在我的iPhone应用程序上使用了cocoa-wrapper api for soundcloud。我试图发布下面的代码,但得到一个错误422.我相信它与字符串 @x-myapplicationurlscheme:// connect有关,但是给了我的网址通过soundcloud看起来像这样:

  https://soundcloud.com/connect 
https://api.soundcloud .com / oauth2 / token
http://api.soundcloud.com/oauth/request_token
http://api.soundcloud.com/oauth/access_token
http:// soundcloud。 com / oauth / authorize

我不认为他们需要插入下面的词典。另一方面,我不知道还有什么可以放在那里。此外,在我看来,我有似乎有助于清除相当多的东西。



我想这个问题太大了,无法回答。我以为我可以插入一些值和几行代码,这就是它。可能不会。


I haven't made much progress, so rather then look for an answer to the error stated in my original question, I think my problem would best be solved by some overall instructions on how to use Oauth properly. Please look below to question reformulated.


ORIGINAL QUESTION

I'm using the cocoa-wrapper api for soundcloud on my iPhone app. I'm trying to post with the code below, but get an error 422. I believe it has to do with the string @"x-myapplicationurlscheme://connect", but the url's given to me by soundcloud look like this:

 https://soundcloud.com/connect
 https://api.soundcloud.com/oauth2/token
 http://api.soundcloud.com/oauth/request_token
 http://api.soundcloud.com/oauth/access_token
 http://soundcloud.com/oauth/authorize

and I don't think they need to be plugged into the Dictionary below. On the other hand I don't know what else to put there. Also, it seems to me there were some errors in the original sample code which I have corrected, but maybe erroneously.

 [api performMethod:@"POST"
     onResource:@"connections"
 withParameters:[NSDictionary dictionaryWithObjectsAndKeys:
                                             @"service", @"twitter",
                                             @"x-myapplicationsurlscheme://connection", @"redirect_uri",
                                             @"touch", @"display", //optional, forces services to use the mobile auth page if available
                                             nil]
        context:nil
       userInfo:nil];

So the question is....

How do I use this POST correctly? What am I doing wrong that gives the error 422?


QUESTION REFORMULATED

What I'm trying to accomplish is to have the user press a button to be able to connect their Soundcloud account to Facebook. This way they can have audio posted to FB automatically after it is uploaded to Soundcloud.

Below are screen shots of my Soundcloud configuration page and places within my app that need setting up. I believe that it is just a matter of plugging in the right the values in the right place, but I'm not sure exactly how to do this. Help, please!

Also, the last screenshot shows what happens when the user presses the Facebook connect button. Does this look right?

Thanks so much,

解决方案

Okay so Chapter 21 Web Services of The Big Nerd Ranch Guide to iPhone Programming seems to have help clear things up quite a bit.

I guess this question was too vast to be answered. I thought I could plug in some values and a couple of lines of code and that would be it. Guess not.

这篇关于如何正确使用Oauth的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆