Nick59
Nick59

Reputation: 31

Tweetinvi 4.0.1 AuthFlow.InitAuthentications returns null

C# implementation. keys verified. Callback urls in place in Twitter app configuration.

using version 4.0.1 and also the JsonLanguageConvertFix

private IAuthenticationContext _authenticationContext;

string TWcallbackURL = href_core_twitter + "?twcc=" + vCode;
var appCreds = new ConsumerCredentials(TWConsumerKey, TWConsumerKey_secret);
_authenticationContext = AuthFlow.InitAuthentication(appCreds, TWcallbackURL);
if(_authenticationContext == null)
                    {
                        _url = "NO URL";
                        _status = "ERROR";
                        _authKey = "";
                        _authSecret = "";
                    }
                    else
                    {
                        _url = _authenticationContext.AuthorizationURL;
                        _authKey = _authenticationContext.Token.AuthorizationKey;
                        _authSecret = _authenticationContext.Token.AuthorizationSecret;
                        _status = "OK";
                    }

_authenticationContext is always null no matter what I have tried. This code was working correctly about a week or so ago.

Upvotes: 1

Views: 76

Answers (1)

Nick59
Nick59

Reputation: 31

The issue was the security protocol. The following is needed:

                    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
                                                        | SecurityProtocolType.Tls11
                                                        | SecurityProtocolType.Tls12
                                                        | SecurityProtocolType.Ssl3;

all is working now.

Upvotes: 2

Related Questions