Search code examples
swiftfirebasetwittertwitter-oauth

Callback url not approved despite being provided Twitter Api


In the twitter console I have a callback url from firebase linked. Yet when I try to authenticate using twitter I get the error:

"Request failed: forbidden (403)" UserInfo={NSLocalizedFailureReason=Twitter API error : <?xml version="1.0" encoding="UTF-8"?><errors><error code="415">Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings</error></errors> (code (null))

Whats going on? I have tried everything , and no one else on the internet seems to have this issue but me?


Solution

  • I face same issue we no need to change in code side, we just need to change some setting in developer account of twitter (tested solution)

    You need to add the consumer/api key in Callback URL using below format

    Ref link : https://developer.twitter.com/en/docs/basics/callback_url.html

    twitterkit-consumer/api key://

    enter image description here

    You need to add twitterkit-yourConsumerKey in info.plist

    <array>
            <dict>
                <key>CFBundleTypeRole</key>
                <string>Editor</string>
                <key>CFBundleURLSchemes</key>
                <array>
                    <string>twitterkit-your Consumer Key (API Key)</string>
                </array>
            </dict>
        </array>