首页 > 解决方案 > Spotifyr 错误:INVALID_CLIENT:重定向 URI 无效

问题描述

我正在尝试使用 spotifyr 包从 Spotify 中提取数据,但是任何需要访问令牌的功能都不起作用(例如 get_my_recently_played(limit = 5))。运行它时出现以下错误:INVALID_CLIENT:无效的重定向 URI。

我什至尝试转到我的应用程序并将重定向 URI 更改为“ http://localhost:8888/callback/ ”,但它仍然给出相同的错误。我可能在这里缺少什么?谢谢!

标签: rspotify

解决方案


你有没有尝试过:

Sys.setenv(SPOTIFY_CLIENT_ID = 'xxxxxxxxxxxxxxxxxxxxx')
Sys.setenv(SPOTIFY_CLIENT_SECRET = 'xxxxxxxxxxxxxxxxxxxxx')

access_token <- get_spotify_access_token()

根据https://github.com/charlie86/spotifyr上的自述文件?

更新:

This works for me with the version of `spotifyr` available on CRAN
Sys.setenv(SPOTIFY_CLIENT_ID = 'your_client_id_here')
Sys.setenv(SPOTIFY_CLIENT_SECRET = 'your_client_secret_here')

access_token <- get_spotify_access_token()

library(spotifyr)

get_artist_audio_features('the beatles')

推荐阅读