title: spotify api javascript auth create playlist
body: <p>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. I am currently working on changing this working auth example:
  <a href="https://codepen.io/martin-barker/pen/QWWePYZ?editors=1010" rel="nofollow noreferrer">https://codepen.io/martin-barker/pen/QWWePYZ?editors=1010</a></p>
  
  <p>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. My first step is moving this codepen out of Vue and into pure javascript.</p>
  
  <p>Line 29 of the javascript is this:</p>
  
  <pre><code>this.me = data
  </code></pre>
  
  <p>Which sends the auth data to the html page, I am trying to change that line to work with pure javascript instead, like:</p>
  
  <pre><code>document.getElementById("spotDiv").innerHTML = data
  </code></pre>
  
  <p>But that just changes the div to display "[Object, object]"</p>
  
  <p>I tried parsing as json with:</p>
  
  <pre><code>document.getElementById("spotDiv").innerHTML = JSON.parse(data)
  </code></pre>
  
  <p>But that causes an error Unexpected token o in JSON at position 1</p>
  
  <p>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?</p>