首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >salesforce lightning使用用户代理OAuth flow和存储访问令牌对来自另一个组织的组织进行身份验证

salesforce lightning使用用户代理OAuth flow和存储访问令牌对来自另一个组织的组织进行身份验证
EN

Stack Overflow用户
提问于 2018-07-19 14:43:44
回答 1查看 554关注 0票数 0
  1. 我已连接在组织2中创建的应用程序,并启用了OAuth。
  2. 我在org1中使用OAuth2.0用户代理工作流,其中我有lightning应用程序。
  3. 单击lightning component页面中的按钮(名为auth target org,
  4. window.open(endpturl,'_self');var currLoc = window.location.href;alert ('Curr Loc is:‘+ currLoc); //打印我单击按钮的位置(名为auth target org)。需要在第7步之后执行此语句。因此,无法捕获salesforce授权/登录页面的访问token.
  5. Redirects。
  6. enter user credential -->单击allow access.
  7. Redirects to be app configured token.
  8. Redirects https://business-momentum-162-dev-ed.cs2.my.salesforce.com/services/oauth2/success#access_token=abc&instance_url=https%3A%2F%2Fdream-innovation-4602-dev-ed.cs40.my.salesforce.com&id=https%3A%2F%2Ftest.salesforce.com%2Fid%2F00D540000009LzUEAU%2F00554000000zjC5AAI&issued_at=1531980498349&signature=abc&scope=id+api&token_type=Bearer

但我无法捕获访问令牌,因为在第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.
   )}

致敬,PJS

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51415990

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档