Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
346 views
in Technique[技术] by (71.8m points)

javascript - spotify api javascript auth创建播放列表(spotify api javascript auth create playlist)

I am trying to make a proof of concept codepen.io project using html and javascript to authenticate someone with spotify, and then make a playlist for the authenticated user.

(我正在尝试使用html和javascript进行概念验证codepen.io项目,以通过spotify对某人进行身份验证,然后为已身份验证的用户创建播放列表。)

I am currently working on changing this working auth example: https://codepen.io/martin-barker/pen/QWWePYZ?editors=1010

(我目前正在更改此工作身份验证示例: https : //codepen.io/martin-barker/pen/QWWePYZ? editors =1010)

It's from a tutorial, and right now when you click a button it opens a popup, the user signs in with that popup, then the user's data is displayed on the html page.

(它来自教程,现在,当您单击一个按钮时,它会打开一个弹出窗口,用户使用该弹出窗口登录,然后该用户的数据将显示在html页面上。)

My first step is moving this codepen out of Vue and into pure javascript.

(我的第一步是将这个Codepen从Vue移到纯JavaScript。)

Line 29 of the javascript is this:

(JavaScript的第29行是这样的:)

this.me = data

Which sends the auth data to the html page, I am trying to change that line to work with pure javascript instead, like:

(它将验证数据发送到html页面,我试图更改该行以改为使用纯JavaScript,例如:)

document.getElementById("spotDiv").innerHTML = data

But that just changes the div to display "[Object, object]"

(但这只是将div更改为显示“ [Object,object]”)

I tried parsing as json with:

(我尝试使用以下方式解析为json:)

document.getElementById("spotDiv").innerHTML = JSON.parse(data)

But that causes an error Unexpected token o in JSON at position 1

(但这会在位置1的JSON中导致错误的意外令牌o)

i can see the original way "this.me = data" is sending json data to the html page, why is my pure js method not working?

(我可以看到原来的方式“ this.me = data”将json数据发送到html页面,为什么我的纯js方法不起作用?)

  ask by Martin translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...