首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >linkedin get配置文件-请求失败:禁止(403)错误迅速

linkedin get配置文件-请求失败:禁止(403)错误迅速
EN

Stack Overflow用户
提问于 2019-07-02 07:09:17
回答 1查看 749关注 0票数 0

我面临的问题是"https://api.linkedin.com/v2/me“api的LinkedIn。当我使用v1 api时,代码运行良好。我已经更新了用于linkedIn身份验证的版本2 api的代码,当我试图使用api "https://api.linkedin.com/v2/me“获取配置文件时,我收到的错误请求失败了:https://api.linkedin.com/v2/me (403)。我不知道怎么解决它。

这是我的代码:

代码语言:javascript
运行
复制
let linkedinHelper = LinkedinSwiftHelper(configuration: LinkedinSwiftConfiguration(clientId: Constant.Key.kLinkedInClientId, clientSecret: Constant.Key.kLinkedInClientSecret, state: Constant.Key.kLinkedInState, permissions: ["r_basicprofile", "r_emailaddress"], redirectUrl: Constant.Key.kLinkedInRedirectURL),nativeAppChecker: WebLoginOnly())
linkedinHelper.authorizeSuccess({ (token) in

        print(token)

        let url = "https://api.linkedin.com/v2/me"
        linkedinHelper.requestURL(url, requestType: LinkedinSwiftRequestGet, success: { (response) -> Void in

            print(response)


        }) {(error) -> Void in
            print(error.localizedDescription)
            //handle the error
        }

我也在info.plist中设置了URL方案。

EN

Stack Overflow用户

回答已采纳

发布于 2019-07-02 09:13:39

您必须在oauth2_access_token中传递密钥

示例:

代码语言:javascript
运行
复制
https://api.linkedin.com/v2/me?oauth2_access_token={linkedin_key}

编辑:-

此外,在权限中,需要设置"r_liteprofile“而不是"r_basicprofile”。改变许可对我来说很有效。

票数 1
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56847093

复制
相关文章

相似问题

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