【发布时间】:2018-07-19 06:43:43
【问题描述】:
我已连接在组织 2 中创建并启用 OAuth 的应用程序。
我在 org1 中使用 OAuth2.0 用户代理工作流,我有 Lightning 应用程序。
点击闪电组件页面中的按钮(名为 auth target org)时,
window.open(endpturl,'_self'); var currLoc = window.location.href; alert ('Curr Loc is: ' + currLoc); //打印我单击按钮的 URL(命名为 auth target org)。预计此语句将在第 7 步之后执行。因此无法捕获访问令牌。
重定向到 salesforce 授权/登录页面。
输入用户凭据 --> 点击允许访问。
但我无法在第 7 步之前执行第 4 步时捕获访问令牌。因此无法捕获访问令牌。如果有办法获取/捕获访问令牌,请告诉我。
client side controller code (**using window object**):
({ AuthTargetOrg : function (component, event, helper) {
var endpturl = 'https://test.salesforce.com/services/oauth2/authorize?response_type=token&client_id=abc123&redirect_uri=https%3A%2F%2Fbusiness-momentum-162-dev-ed.lightning.force.com%2Fservices%2Foauth2%2Fsuccess';
window.open(endpturl,'_self');
var currLoc = window.location.href;
alert ('Curr Loc is: ' + currLoc); // prints home page URL from where I clicked "auth target org" button, rather this statement expected to execute after step 7.
)}
问候, 睡衣
【问题讨论】:
标签: javascript oauth-2.0 salesforce-lightning