LoginSignup
9
7

More than 3 years have passed since last update.

GASでTwitterのAPI利用時にエラー(Callback URL not approved)が出た場合の対処法

Posted at

前提

GoogleAppsScript(GAS)を用いたTwitterのAPIを利用する際の認証時にエラーが出たので対処法を記録しておきます。

事象

Error starting OAuth flow: 
<?xml version="1.0" encoding="UTF-8"?>
<errors><error code="417">Desktop applications only support the oauth_callback value 'oob'</error></errors> 
(line 334, file "Service", project "OAuth1")

Twitter Apps側の設定でCallback URLを設定していなかったことが原因。
適当なURLを入力すると下記のエラーメッセージに変わる。

Error starting OAuth flow: 
<?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>
 (line 334, file "Service", project "OAuth1")

対処法

適切なURLを入力する。

https://script.google.com/macros/d/[GASのスクリプトID]/usercallback

[GASのスクリプトID]はGAS利用時のURLの該当部分のこと。

https://script.google.com/d/[GASのスクリプトID]/edit
9
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
7