【问题标题】:Hapi Bell Twitter Auth with emailHapi Bell Twitter Auth 与电子邮件
【发布时间】:2016-11-18 22:00:36
【问题描述】:

我正在努力获取 Twitter 用户登录时的电子邮件地址

我从 Joi 收到以下错误“错误:未捕获的错误:无效的选项值:必须为真、假或对象”

server.auth.strategy('twitter', 'bell', {
    provider: 'twitter',
    scope: ['public_profile', 'email'],
    config: {
        extendedProfile: true,
        getParams: 'include_email',
        getMethod: 'account/verify'
    },
    password: config.longpass, //Use something more secure in production
    clientId: config.twitter_key,
    clientSecret: config.twitter_secret,
    isSecure: config.useHttps //Should be set to true (which is the default) in production
});

【问题讨论】:

    标签: twitter hapijs joi


    【解决方案1】:

    此代码对我有用。

    server.auth.strategy('twitter', 'bell', {
        provider: 'twitter',
        config: {
            getMethod: 'account/verify_credentials',
            getParams: {include_email:'true' },//doesn't work without quotes!
        },
        password: 'secret_cookie_encryption_password', //Use something more secure in production
        clientId: secret.twitterId,
        clientSecret: secret.twitterSecret,
        isSecure: false //Should be set to true (which is the default) in production
    });
    

    不要忘记在您的 Twitter 应用程序设置中允许必要的权限(向用户请求电子邮件地址)。

    【讨论】:

      猜你喜欢
      • 2020-01-05
      • 1970-01-01
      • 1970-01-01
      • 2013-09-02
      • 1970-01-01
      • 1970-01-01
      • 2015-03-14
      • 1970-01-01
      • 2017-02-20
      相关资源
      最近更新 更多