Linkedin API oAuth 2.0 REST查询参数 [英] Linkedin API oAuth 2.0 REST Query parameters

查看:83
本文介绍了Linkedin API oAuth 2.0 REST查询参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在向回调URL添加查询时遇到问题.尝试授权以下字符串时,我收到无效的URI方案错误:

https://developer.linkedin.com/forum/oauth-20-redirect-url-faq-invalid-redirecturi-error 表示您可以使用查询参数.在第一个请求中,看来我做得正确.在此页面上发布#25- https://developer.linkedin.com/论坛/获取权限时出现错误表示您必须删除查询参数才能使其正常工作

任何人都有使用oAuth2.0成功在linkedin API的回调URL中传递其他查询参数的经验吗?如果是这样,我在做什么错了?

解决方案

您不允许这样做. 请参阅文档: https://developer.linkedin.com/docs/oauth2

请注意:

我们强烈建议尽可能使用HTTPS 网址必须是绝对网址(例如," https://example.com/auth/callback ,而不是"/验证/回调") URL参数被忽略(即 https://example.com/?id=1 https://example.com/) 网址不能包含#(即" https://example.com/auth/callback#linkedin"无效)

I'm running into a problem with adding a query to the callback URL. I'm getting an invalid URI scheme error attempting to authorize the following string:

https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=75df1ocpxohk88&scope=rw_groups%20w_messages%20r_basicprofile%20r_contactinfo%20r_network&state=7a6c697d357e4921aeb1ba3793d7af5a&redirect_uri=http://marktest.clubexpress.com/basic_modules/club_admin/website/auth_callback.aspx?type=linkedin

I've read some conflicting information in forum posts here. Some say that it's possible to add query strings to callbacks, and others say that it results in error.

If I remove ?type=linkedin, I can authorize just fine and receive the token. It would make my life so much easier if I could use a query string on the callback url, as I need to do some additional processing in the callback.

In short, can I append a query string to the end of the callback url?

For fun, I tried encoding the callback url in the request (obviously this is a no-no according to their documentation): https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=75df1ocpxohk88&scope=rw_groups%20w_messages%20r_basicprofile%20r_contactinfo%20r_network&state=5cabef71d89149d48df523558bd12121&redirect_uri=http%3a%2f%2fmarktest.clubexpress.com%2fbasic_modules%2fclub_admin%2fwebsite%2fauth_callback.aspx%3ftype%3dlinkedin

This also resulted in an error but was worth a shot.

The documetation here: https://developer.linkedin.com/forum/oauth-20-redirect-url-faq-invalid-redirecturi-error indicates that you CAN use query parameters. And in the first request, it appears that I'm doing it correctly. Post #25 on this page - https://developer.linkedin.com/forum/error-while-getting-access-token indicates that you have to remove the query parameters to make it work

Anyone have experience with successfully passing additional query paramaters in the callback url for the linkedin API using oAuth2.0? If so, what am I doing wrong?

解决方案

You not allowed to do that. Refer to the doc: https://developer.linkedin.com/docs/oauth2

Please note that:

We strongly recommend using HTTPS whenever possible URLs must be absolute (e.g. "https://example.com/auth/callback", not "/auth/callback") URL arguments are ignored (i.e. https://example.com/?id=1 is the same as https://example.com/) URLs cannot include #'s (i.e. "https://example.com/auth/callback#linkedin" is invalid)

这篇关于Linkedin API oAuth 2.0 REST查询参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆