Owin Twitter 로그인-유효성 검사 절차에 따라 원격 인증서가 유효하지 않습니다.
최근에 트위터를 사용하여 로그인하려고 할 때이 오류가 발생하기 시작했습니다. 그 이유는 무엇입니까?
Stack Trace:
[AuthenticationException: The remote certificate is invalid according to the validation procedure.]
System.Net.TlsStream.EndWrite(IAsyncResult asyncResult) +230
System.Net.PooledStream.EndWrite(IAsyncResult asyncResult) +13
System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar) +123
[WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.]
System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) +6432446
System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar) +64
오픈 소스의 힘 덕분에 트위터 인증서의 지문이 Katana 프로젝트에서 코딩되었음을 알 수 있습니다.
Microsoft.Owin.Security.Twitter.TwitterAuthenticationOptions
최근에 일부 인증서가 변경되어 이제 지문이 더 이상 일치하지 않습니다.
"VeriSign 클래스 3 공용 기본 인증 기관-G5"인증서에 대한 새 지문을 귀하의 트위터 인증 옵션 Startup.Auth.cs
(MVC 사용자 용)에 추가하십시오.
기본값에서 변경 :
app.UseTwitterAuthentication(
consumerKey: "XXXX",
consumerSecret: "XXX"
);
이것을 사용하십시오 :
app.UseTwitterAuthentication(new TwitterAuthenticationOptions
{
ConsumerKey = "XXXX",
ConsumerSecret = "XXXX",
BackchannelCertificateValidator = new CertificateSubjectKeyIdentifierValidator(new[]
{
"A5EF0B11CEC04103A34A659048B21CE0572D7D47", // VeriSign Class 3 Secure Server CA - G2
"0D445C165344C1827E1D20AB25F40163D8BE79A5", // VeriSign Class 3 Secure Server CA - G3
"7FD365A7C2DDECBBF03009F34339FA02AF333133", // VeriSign Class 3 Public Primary Certification Authority - G5
"39A55D933676616E73A761DFA16A7E59CDE66FAD", // Symantec Class 3 Secure Server CA - G4
"5168FF90AF0207753CCCD9656462A212B859723B", //DigiCert SHA2 High Assurance Server CA
"B13EC36903F8BF4701D498261A0802EF63642BC3" //DigiCert High Assurance EV Root CA
})
});
댓글을 파는 사람들을 요약하고 저장하려면 여기에 최신 구성이 있습니다.
app.UseTwitterAuthentication(new TwitterAuthenticationOptions
{
ConsumerKey = "XXXX",
ConsumerSecret = "XXXX",
BackchannelCertificateValidator = new Microsoft.Owin.Security.CertificateSubjectKeyIdentifierValidator(new[]
{
"A5EF0B11CEC04103A34A659048B21CE0572D7D47", // VeriSign Class 3 Secure Server CA - G2
"0D445C165344C1827E1D20AB25F40163D8BE79A5", // VeriSign Class 3 Secure Server CA - G3
"7FD365A7C2DDECBBF03009F34339FA02AF333133", // VeriSign Class 3 Public Primary Certification Authority - G5
"39A55D933676616E73A761DFA16A7E59CDE66FAD", // Symantec Class 3 Secure Server CA - G4
"add53f6680fe66e383cbac3e60922e3b4c412bed", // Symantec Class 3 EV SSL CA - G3
"4eb6d578499b1ccf5f581ead56be3d9b6744a5e5", // VeriSign Class 3 Primary CA - G5
"5168FF90AF0207753CCCD9656462A212B859723B", // DigiCert SHA2 High Assurance Server CA
"B13EC36903F8BF4701D498261A0802EF63642BC3" // DigiCert High Assurance EV Root CA
})
});
@MichaelLake 및 @KennethIto에 대한 모든 크레딧.
Fiddler를 끕니다.
어떻게 든 Fiddler 웹 디버거가 Twitter의 Oauth를 엉망으로 만듭니다.
For testing purposes only (!) it is also possible to set the
options.BackchannelCertificateValidator = null;
and add to your Global.asax Application_Start:
ServicePointManager.ServerCertificateValidationCallback = delegate
{
return true;
};
The DigiCert SHA2 High Assurance Server CA value of "5168FF90AF0207753CCCD9656462A212B859723B" doesn't seem to be valid. The new value is "01C3968ACDBD57AE7DFAFF9552311608CF23A9F9". It's valid from 6/28/2016 to 9/19/2019. I found it by going to https://api.twitter.com/ in Chrome, then clicking on the padlock in the address bar to view the certificate.
I had this exact problem I followed the post above and I got the 401 (unauthorized) error mentioned in another comment.
I went to my Twitter dev account and unchecked a box titled: "Enable Callback Locking". Clicked save, hit F5 and it worked.
So the above code worked for me. If you get a 401 double check your Twitter account for the checkbox.
For me, just updating Microsoft.Owin.Security.Twitter
to version 3.1.0 fixed it, even without adding the thumbprints!
I had the same issue, and I have updated the callback URL in my Twitter App.
Adding the default URL https://mywebsite/signin-twitter
'Program Tip' 카테고리의 다른 글
배치 파일의 현재 디렉토리를 찾고 경로에 사용하려면 어떻게합니까? (0) | 2020.11.06 |
---|---|
Jquery 입력 배열 필드 가져 오기 (0) | 2020.11.06 |
런타임에 하위 클래스가 클래스의 인스턴스인지 확인하는 방법은 무엇입니까? (0) | 2020.11.06 |
변수, 객체 및 참조의 차이점은 무엇입니까? (0) | 2020.11.06 |
Python의 AWS Lambda 가져 오기 모듈 오류 (0) | 2020.11.06 |