しがないエンジニアのブログ

技術的な内容をメモ代わりにつらつら

twitterのOAuth認証ではまったこと

最近twitter APIを使ってOAuth認証しようとしたら、以下のようなエラーが出てハマった。

Callback URL not approved for this client application.

これは、callback URLが間違ってるよみたいなこと
2018.6.13以降はちゃんと対応させないとだめになった
なので、アプリ登録したページから、以下のcallback URLを設定
https://developer.twitter.com/en/apps

f:id:turgure:20180907222004p:plain

その後、ソースを変更

twitter.getOAuthRequestToken("app://");

AndroidManifest.xmlも設定してたら変更

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="app" />
</intent-filter>

これでヨシ


参考URL