Ranbeuer
Ranbeuer

Reputation: 167

Unable to sign in with twitterkit

I'm trying to login with twitterkit using the instructions provided in the developers portal, but to no avail. Everytime i try to do so, be it with loginWithCompletion, loginWithViewController or with TWTRLoginButton I get this error in the log:

CredStore - performQuery - Error copying matching creds.  Error=-25300, query={
class = inet;
"m_Limit" = "m_LimitAll";
ptcl = htps;
"r_Attributes" = 1;
sdmn = "https://api.twitter.com";
srvr = "api.twitter.com";
sync = syna;
}
[TwitterKit] did encounter error with message "Error obtaining user auth token.": Error Domain=TWTRLogInErrorDomain Code=-1 "{"errors":[{"code":32,"message":"Could not authenticate you."}]}" UserInfo={NSLocalizedDescription={"errors":[{"code":32,"message":"Could not authenticate you."}]}}

This is the content of my plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
...
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSAllowsArbitraryLoadsInWebContent</key>
    <true/>
    <key>NSExceptionDomains</key>
    <dict>
        <key>twitter.com</key>
        <dict>
            <key>NSExceptionRequiresForwardSecrecy</key>
            <false/>
            <key>NSIncludesSubdomains</key>
            <true/>
        </dict>
    </dict>
</dict>
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>twitterkit-XXXXXXXXX</string>
        </array>
    </dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>twitter</string>
    <string>twitterauth</string>
</array>
</dict>
</plist>

This is a small test application I had to do to check if I was making any mistakes in my main app, but sadly I can't login either.

My podfile is:

source 'https://github.com/CocoaPods/Specs.git'
inhibit_all_warnings!
platform :ios, '9.0'
target 'Statkid' do
pod 'TwitterKit'
end

And the log says the following:

Installing TwitterCore (3.1.0) Installing TwitterKit (3.3.0)

In my app settings I have Calback Locking enabled and Allow this application to sign in with twitter enabled.

I would appreciate if you could help me.

Also, I'm deploying for iOS 9.

Edit:

I had an extra space upon initializing twitter in the consumer secret, but still now I'm getting this:

[TwitterKit] did encounter error with message "Error obtaining user auth token.": Error Domain=TWTRLogInErrorDomain Code=-1 "<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <error>This client application's callback url has been locked</error>
  <request>/oauth/request_token</request>
</hash>
" UserInfo={NSLocalizedDescription=<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <error>This client application's callback url has been locked</error>
  <request>/oauth/request_token</request>
</hash>

Upvotes: 3

Views: 2749

Answers (2)

Sreeraj VR
Sreeraj VR

Reputation: 1574

You have to set it in Twitter dashboard (https://apps.twitter.com) . Please see this screenshot

enter image description here

Upvotes: 4

Jim Keir
Jim Keir

Reputation: 545

From June 12th 2018 callback locking will no longer be optional. The correct callback format for iOS apps is:

twitterkit-MY_CONSUMER_KEY://

Upvotes: 13

Related Questions