サイトを見て、SpotifyのClient IDとClient Secretをエンコードしたのですが、
参考
Spotify Web APIの使い方 | DevelopersIO
https://dev.classmethod.jp/etc/about-using-of-spotify-api/
Client Credentials Flowでアクセストークンを取得
まずは、Client IDとClient SecretをBase64でエンコードした値を取得します。
Macならばターミナル上で下記を実行します。
echo -n {client_id}:{Client_Secret} | base64
出力された値を「ZjM4ZjAw...WY0MzE=」とした場合、以下のようにリクエストを実行します。
curl -X "POST" -H "Authorization: Basic ZjM4ZjAw...WY0MzE=" \ -d grant_type=client_credentials https://accounts.spotify.com/api/token
のコードをエンコードされたものに変えても、エラーが出ます。
<!DOCTYPE html> <html ng-app="accounts" ng-csp> <head> <meta charset="utf-8"> <title>Error - Spotify</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <base href="/"> <link rel="icon" href="https://accounts.scdn.co/images/favicon.ace4d8543bbb017893402a1e9d1ac1fa.ico"> <link href="https://accounts.scdn.co/css/index.9f7d279c1ccfb924805f.css" media="screen" rel="stylesheet"> </head> <body> <div class="head"> <a class="spotify-logo" href="/" tabindex="-1" title="Spotify"></a> </div> <div class="container-fluid error"> <div class="content"> <h1 class="h1">Error</h1> <p> Oops! Something went wrong, please try again or check out our <a href="https://www.spotify.com/help">help area</a>. </p> </div> </div> <script async defer src="https://accounts.scdn.co/js/error.efd29027d79f6416d818.js" sp-error=''></script> </body> </html>
エンコードするコマンドが正しいのか教えて頂きたいです。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/06/27 14:46
2019/06/27 14:52
2019/06/27 14:54
2019/06/27 23:53
2019/06/28 09:28