BrowserField2 - salesforce oauth2 在接受/拒绝阶段失败
我有一个基于 BlackBerry java 的应用程序,可处理 salesforce 数据并使用 oauth 2 进行身份验证。它一直工作良好,直到最近,用户抱怨一旦他们进入接受/拒绝 salesforce oauth 页面,单击“接受”按钮就会显示 salesforce 404 页面。
我将调试器附加到 bb 模拟器 (OS7),发现一切工作正常,直到通过 salesforce oauth2 用户代理流程在身份验证/授权的最后阶段按下 ACCEPT 按钮时向 salesforce 发出 POST。此时,帖子将成功,响应正文将包含一些带有小 JavaScript 块的标记,该块仅执行 document.location.href 分配以强制浏览器导航到新 URL。我注意到 URL 不是我所期望的 - 我期望看到redirect_uri回调地址+访问令牌等数据附加到它的末尾(根据sf oauth2文档)。相反,我看到的是一个 URL,当导航到该 URL 时,会将用户带回到登录页面,并显示一条消息,表明他们正在尝试访问需要身份验证的资源。
如果我在 chrome 中执行相同的流程,则帖子后面的 URL 就是我所期望的。这一切过去都工作得很好,所以我很困惑为什么它会突然停止工作。我听说 Salesforce 在 2011 年底稍微改变了他们的 oauth 2 实现,所以我想知道这是否破坏了我的客户端,尽管我不知道如何破坏。
作为实验,我删除了除嵌入的 BrowserField 之外的所有代码,并使其导航到通过组合消费者密钥和文档中的各种其他值构建的 oauth URL,但在单击时仍然会失败并显示 404 页面成功登录后的接受按钮。
如果我在内置 bb 浏览器中尝试相同的引导 oauth URL,则完整的身份验证流程工作正常,并且我最终会重定向到附加了访问令牌信息的最终回调 URL。
还有其他人在 BrowserField (来自 field2 包)上的 oauth2 用户代理流遇到问题吗?
I have a BlackBerry java-based app that works with salesforce data and uses oauth 2 for authentication. It has been working fine until recently when users have been complaining that once they get to the accept/deny salesforce oauth page, clicking on Accept button displays a salesforce 404 page.
I attached a debugger to the bb simulator (OS7) and found that everything was working fine up to the point where a POST is made to salesforce on pressing the ACCEPT button in the final stage of authentication/authorisation via salesforce oauth2 user agent flow. At this point, the post would succeed and the response body would contain some markup with a small JavaScript block that just performs a document.location.href assignment to force the browser to navigate to a new URL. I noticed that the URL was not what I was expecting - I was expecting to see the redirect_uri callback address + the access token etc data appended to the end of it (as per the sf oauth2 documentation). What I saw instead was a URL that when navigated to leads the user back to a login page with a message saying that they are attempting to access a resource that requires authentication.
If I perform the same flow in say chrome the URL after the post is what I expect. This all used to work just fine so I am confused as to why it would stop working all of a sudden. I've heard that Salesforce changed their oauth 2 implementation back in late 2011 slightly so I wonder if this has broken my client although I don't see how.
As an experiment I removed all of my code except for an embedded BrowserField and made it navigate to the oauth URL as constructed by combining consumer key and various other values as per the documentation and it still fails with a 404 page at the point of clicking on the accept button after a successful login.
If I try the same bootstrap oauth URL in the built in bb browser the full authentication flow works fine and I am eventually redirected to the final callback URL with access token information appended.
Has anyone else out there had trouble with oauth2 user agent flow on BrowserField (from field2 package)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过使用“scope=mobile”参数?此参数使您进入一个非常简化的 oauth 流程,该流程针对黑莓进行了优化...我们发现他们通常难以通过为 iOS/Android 设计的更丰富的流程。也就是说,我还没有听说他们在 BB7 上有问题...只有 5 系列,有时是 6 系列。
如果失败,您可以向我们提出支持案例吗?
Have you tried using the "scope=mobile" parameter? This parameter puts you into a very simplified oauth flow that is optimized for blackberry...we've found they generally have trouble getting through the richer flows designed for iOS/Android. That said, I haven't heard of them having issues on BB7...only the 5 and sometimes 6 series
If that fails, could you open a support case with us?
另请尝试“
display=mobile
”和“scope=api web
”(带空格),具体取决于您在 OAuth 后尝试访问的内容。Try also "
display=mobile
" and "scope=api web
" (with a space), depending on what you are trying to access after OAuth.