我尝试通过OAuth2获取Pinterest令牌,但是返回回调redirect_uri不匹配错误。
平台:iOS
我不想使用PINTEREST IOS SDK。我使用Rest API。
我到目前为止所做的;
info.plist中更新了自定义URL方案。
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string></string>
<key>CFBundleURLSchemes</key>
<array>
<string>pdk{your-app-id}</string>
</array>
</dict>
</array>
快捷代码:
let redirectURI = URL(string: "???????")!
let oauthSwift = OAuth2Swift(consumerKey: "-", consumerSecret: "-",
authorizeUrl: "https://api.pinterest.com/oauth",
accessTokenUrl: "https://api.pinterest.com/v1/oauth/token",
responseType: "code")
oauthSwift.authorize(withCallbackURL: redirectURI,
scope: "read_public,write_public",
state: "pinterest",
success: { (credential, response, parameters) in
print("")
}) { (error) in
print(error.localizedDescription)
}
研究:
我该如何解决?
谢谢