POST https://www.linkedin.com/uas/oauth2/accessTok

2020-02-26 11:54发布

I am using the LinkedIn Owin Middleare and started running into issues this morning and have now reproduced it to the below error:

POST https://www.linkedin.com/uas/oauth2/accessToken HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host: www.linkedin.com
Cookie: bscookie="v=1&201504071234373bc02b47-9d08-477f-8375-b80b281ef416AQEptFjv8jXPI93YmF-H-3kvnwSLwBF8"; bcookie="v=2&46f6f299-6702-48bf-8634-7ba023bd5099"; lidc="b=LB23:g=218:u=215:i=1428412320:t=1428487523:s=AQEQQq6vlEKPT3LW8c0cPEzRTKp-ToxL"
Content-Length: 267
Expect: 100-continue
Connection: Keep-Alive

grant_type=authorization_code&code=AQQRSgEH8vczSFJKNxtMpunzjYN6YJxoF2hiX_d9RVkqBvMC7TzRpur0p9NJFdQOUNf8RmFyj_cCg3ENTucRw5e-gQfEZ5sPGoujiFRsQ8Tb0pLnaog&redirect_uri=http%3A%2F%2Flocalhost%3A1729%2Fsignin-linkedin&client_id=&client_secret=

Results in method not found.

HTTP/1.1 405 Method Not Allowed
Date: Tue, 07 Apr 2015 13:13:16 GMT
Content-Type: text/html
Content-Language: en
Content-Length: 5487
X-Li-Fabric: PROD-ELA4
Strict-Transport-Security: max-age=0
Set-Cookie: lidc="b=LB23:g=218:u=215:i=1428412396:t=1428487523:s=AQExeP2uX-7KXQv79NIZmW0LB09uE4eJ"; Expires=Wed, 08 Apr 2015 10:05:23 GMT; domain=.linkedin.com; Path=/
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: no-cache, no-store
Connection: keep-alive
X-Li-Pop: PROD-IDB2
X-LI-UUID: 0FM/jIG90hPAzyhAqCsAAA==

Looking for anyone to confirm that there was a change on linkedin causing this error and that its not application specific.

Note that i removed teh above clientid/secrets.

标签: linkedin
6条回答
虎瘦雄心在
2楼-- · 2020-02-26 12:06

I also spent most of the morning off and on trying to get this to work. Frustratingly it worked fine using Advanced Rest Client chrome tool. A combination of this and fiddler showed the only difference in the header was that Expect: 100-continue flag in the header. The only way I was able to get it to be set to false was in the web.config section

<system.net>
    <settings>
        <servicePointManager expect100Continue="false" />
    </settings>
</system.net>

Hope this helps.

查看更多
贪生不怕死
3楼-- · 2020-02-26 12:08

Found a solution for curl, pretty simple:

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:') );
查看更多
何必那么认真
4楼-- · 2020-02-26 12:14

I started having this issue today. After some research about Expect: 100-continue I found that putting System.Net.ServicePointManager.Expect100Continue = false;

in my Application_Start() function inside of Global.asax, takes out the 100-continue from the request and my login with LinkedIn is now working again.

Not a permanent fix as I would like to now why it broke in the first place.

查看更多
一纸荒年 Trace。
5楼-- · 2020-02-26 12:19

I had same issue also use DotNetOpenAuth.

How I fix:

  1. I remove from request header "Expect: 100-continue"
  2. in my case redirect_uri was encoded and I remove encode for redirect_uri (for request to https://www.linkedin.com/uas/oauth2/accessToken )
查看更多
够拽才男人
6楼-- · 2020-02-26 12:21

For those using Owin Middleware and Owin.Security.Providers

A pre-release nuget was created with a fix. https://www.nuget.org/packages/Owin.Security.Providers/1.17.0-pre

This works for now. But until we know what linkedin has changed or comes with statement about what they changed people can use this as a hotfix.

Alittle more background on the fix can be found at : https://github.com/RockstarLabs/OwinOAuthProviders/issues/87#issuecomment-90838017

But the root cause is that LinkedIn changed something on there accessToken endpoint causing most of the libs using linkedin SSO had to apply a hotfix, but we yet haven't heard anything from linkedin.

查看更多
聊天终结者
7楼-- · 2020-02-26 12:31

I ran into this issue this morning too (I'm using DotNetOpenAuth). It looks like this is related to the use of the following request header: Expect: 100-continue

After removing this request header, the HTTP/1.1 405 Method Not Allowed response no longer occurs. Obviously this isn't much help if you don't have access to the source code!

I'm assuming this is due to a change in LinkedIn as I only started experiencing problems this morning. I'm guessing they'll need to look into a fix for this.

查看更多
登录 后发表回答