【问题标题】:How to obtain a LinkedIn token via Titanium如何通过 Titanium 获取 LinkedIn 令牌
【发布时间】:2016-01-06 23:35:20
【问题描述】:

我想通过 LinkedIn 登录我的应用程序。这可以通过调用 Cloud.SocialIntegrations.externalAccountLogin() 来完成。

但是,上面的函数需要一个“token”参数。 “令牌”由 LinkedIn 按照 oauth 流程提供(检索授权码,将授权码交换为请求令牌)。

钛中有没有简单的方法来获得这个令牌?我调查了 aaronksaunders(https://github.com/aaronksaunders/clearlyinnovative.linkedIn) 的代码,并在 gitt.io 上进行了搜索。还是我们需要自己编写所有这些样板代码?

注意:目前,我不想通过服务器代理呼叫(我不想设置 SSL 证书等)并且我没有 appcelerator 团队或企业计划,所以我可以'不要使用他们的节点(箭头)后端来代理这些调用。

附加问题:配置 iOS Bundle Identifiers 是否足够(在 LinkedIn 应用程序设置页面上)?我是否需要使用此“iOS 设置”应用程序 ID(也在 LinkedIn 应用程序设置页面上)?

【问题讨论】:

    标签: titanium titanium-mobile linkedin-api


    【解决方案1】:

    我已成功完成我的流程。一切都在 Ramkumar M 的这篇博文中进行了解释:http://shareourideas.com/2012/12/18/linkedin-connect-for-appcelerator-titanium/。结果是通过使用经过修改的 commonjs 模块版本的 social.js 库来实现的:https://gist.github.com/rampicos/4320296

    这个库有一个很干净的api,整个流程无非就是:

    var social = require('social');
    var linkedin = social.create({
      consumerSecret : CONSUMER_SECRET,
      consumerKey : CONSUMER_KEY,
      site: 'linkedin'
    });
    
    linkedin.authorize(function(){
      //callback
    });
    

    我不使用

    Cloud.SocialIntegrations.externalAccountLogin()
    

    因为登录是由 social.js 库完成的。

    LinkedIn 应用:我只配置了 iOS 捆绑包标识符。

    【讨论】:

      猜你喜欢
      • 2022-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-27
      • 2012-04-09
      • 2012-09-04
      • 2018-06-13
      • 2020-05-15
      相关资源
      最近更新 更多