问题描述
我在一个 PHP 编码的网站上创建了一个带有苹果音乐功能的登录,到目前为止一切顺利。我可以从用户那里登录获取 access_token,我还可以使用我的加密开发者令牌获取公开曲目和播放列表信息。
但是我还想为登录用户创建一个库播放列表,docs in apple 建议进行个人更改,我需要添加一个特殊的标题:
Music-User-Token: [music user token]
我假设 Music-User-Token 是用户的 access_token,但失败了,我也尝试了登录会话中的 id_token,但它也失败了。
我的结束 CURL 请求如下所示:
curl -v \
-H 'Content-Type: application/json' \
-H 'Music-User-Token: USER_MUSIC_TOKEN' \
-H 'Authorization: Bearer DEVELOPER_TOKEN' \
--request POST \
--data '{"attributes":{"name":"1622799194 playlist","description":""},"relationships":{"tracks":{"data":[{"id":"1560879523","type":"songs"}]}}}' \
"https://api.music.apple.com/v1/me/library/playlists"
我得到的回应是:
* upload completely sent off: 135 out of 135 bytes
< HTTP/1.1 403 Forbidden
< Content-Type: application/json;charset=utf-8
< Content-Length: 132
< Server: daiquiri/3.0.0
< x-apple-jingle-correlation-key: 7QETXMYLA5HYFGWO75NMIYAZ2E
< x-apple-request-uuid: fc093bb3-0b07-4f82-9ace-ff5ac46019d1
< b3: fc093bb30b074f829aceff5ac46019d1-3adb16d23e03d043
< x-b3-traceid: fc093bb30b074f829aceff5ac46019d1
< x-b3-spanid: 3adb16d23e03d043
< apple-seq: 0.0
< apple-tk: false
< apple-originating-system: MZStorePlatform
< X-Apple-Application-Site: ST11
< X-Apple-Application-Instance: 2513606
< x-responding-instance: MZStorePlatform:2513606:::
< apple-timing-app: 11 ms
< Cache-Control: private,no-cache,no-store,no-transform,must-revalidate,max-age=0
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< is-jetty: true
< x-apple-lokamai-no-cache: true
< x-daiquiri-instance: daiquiri:48626004:st53p00it-qujn14050101:7987:21HOTFIX5
< Access-Control-Allow-Origin: *
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< Date: Fri,04 Jun 2021 09:55:15 GMT
< Connection: close
<
* Closing connection 0
{"errors":[{"id":"7QETXMYLA5HYFGWO75NMIYAZ2E","title":"Forbidden","detail":"Invalid authentication","status":"403","code":"40300"}]}
如何手动为 Apple Music Kit Music-User-Token 生成正确的?
谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)