Salesforce PhoneGap iPhone应用程序中的oAuth2问题(远程访问应用程序授权问题)

时间:2012-06-25 14:31:23

标签: iphone cordova salesforce oauth-2.0 phonegap-plugins

我使用PhoneGap创建了一个iPhone应用程序。我已经按照本教程中的代码进行了操作:

Building PhoneGap Mobile Applications Powered by Database.com

我已成功登录并在此屏幕中被击中: enter image description here

我无法移动到其他屏幕来访问数据。这是成功登录后生成的URL:

https://login.salesforce.com/services/oauth2/success#access_token=0000&refresh_token=0000&instance_url=https%3A%2F%2Fna12.salesforce.com&id=https%3A%2F%2Flogin.salesforce.com%2Fid%000C&issued_at=0000&signature=qqqq&scope=id+api+refresh_token

我是否需要在此网址中添加cosumer密钥?这是我的回调:

https://login.salesforce.com/services/oauth2/success

会出现什么问题?我错过了什么吗?

1 个答案:

答案 0 :(得分:0)

所以https://login.salesforce.com/services/oauth2/success是回调的存根URL - 这是您在那里看到的屏幕,access_token变量是您的用户会话ID。因此OAuth流程正常运行。

在代码中,您可以查看是否:

oauthResponse.access_token

设置正确。如果是这样,它看起来像:

sfw.login( setupHomeView );

应该告诉它从该页面移动到下一个UI页面。

您还可以查看Force.com Mobile SDK: http://developer.force.com/MobileSDK

它还包括PhoneGap,内置了一个很棒的OAuth包装器。

相关问题