使用Swift使用oAuth进行Flickr授权

时间:2015-03-28 12:16:35

标签: swift oauth flickr

我想通过oAuth获得Flickr授权,但我的回复是空的。我就是这样做的。

  1. 像这样创建基本字符串(XXX..XX是oauth_consumer_key):
  2.   

    GET&安培; HTTPS%3A%2F%2Fwww.flickr.com%2Fservices%2Foauth%2Frequest_token&安培; oauth_callback%3Doob%26oauth_consumer_key%3DXXXXXXXXXXXXXXX%26oauth_nonce%3D91133798%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1427542658

    1. 使用HMAC-SHA1进行Genarate签名:
    2.   

      128974f0e49251f6bd705f7bf9dadbd3dafe90a4

      1. 创建了带有基本字符串和签名的请求字符串,如下所示:
      2.   

        https://www.flickr.com/services/oauth/request_token?oauth_callback=oob&oauth_consumer_key=XXXXXXXXXXXXXXXX&oauth_nonce=61061285&oauth_signature=128974f0e49251f6bd705f7bf9dadbd3dafe90a4&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1427542658

        1. 我调用了请求字符串" requestStringSignature"

          var url = NSURL(string: requestStringSignature)
          var request = NSURLRequest(URL: url!) 
          NSURLConnection.sendAsynchronousRequest(
              request,
              queue: NSOperationQueue.mainQueue(),
              completionHandler: {
                  (response, data, error) -> Void in
                  println(response)
              }
          )
          

          回应是零。

        2. 请帮忙。

0 个答案:

没有答案