【问题标题】:Passport-github js, user-agent errorPassport-github js,用户代理错误
【发布时间】:2013-04-18 14:52:35
【问题描述】:

昨天我可以通过Passport.jsPassport-github模块成功登录我的应用程序,今天我收到这样的错误:

500 failed to fetch user profile (status: 403 data: {"message":"Missing or invalid User Agent string. See http://developer.github.com/v3/#user-agent-required"})

所以其他人得到它?

gihub oauth 政策是否发生了变化?

我们是否需要在 passport-github / node-oauth 模块上为此做出贡献?

【问题讨论】:

    标签: javascript node.js github oauth passport.js


    【解决方案1】:

    只需将用户代理添加到您的策略中:

    new GitHubStrategy({
            clientID: <githubClientID>,
            clientSecret: <githubClientSecret>,
            callbackURL: <callback>,
            customHeaders: {"User-Agent" : <your agent string>}
          },
          findOrCreateUserByOAuth
        )
    

    自 4 月 24 日起,User Agent is now mandatory

    【讨论】:

    • 你在哪里可以找到这个用户代理字符串?
    猜你喜欢
    • 1970-01-01
    • 2018-07-23
    • 1970-01-01
    • 2020-08-10
    • 2013-03-20
    • 2018-05-07
    • 2018-01-16
    • 2011-12-30
    • 2021-12-21
    相关资源
    最近更新 更多