“415 Error” when querying Spotify for tokens

后端 未结 3 1567
花落未央
花落未央 2020-12-20 13:17

I\'ve been trying to recreate the spotify oauth connection in MeteorJS. I\'ve gotten as far as requesting the access and refresh tokens, but I keep getting a 415 error now.

相关标签:
3条回答
  • 2020-12-20 13:45

    You need to use params instead of data when sending the JSON object. Related question: Unsupported grant type error when requesting access_token on Spotify API with Meteor HTTP

    0 讨论(0)
  • 2020-12-20 13:47

    I had a similar problem (but in Java). The analogous solution was

                        headers: {
                            'Content-Type':'application/x-www-form-urlencoded'
                        }
    
    0 讨论(0)
  • 2020-12-20 13:51

    If youre doing this clientside its not working because you're not allowed to post to another domain from the client side because of the same origin policy.

    If this is server-side I'd recommend using a pre-existing spotify api npm module instead of writing your own requests. There are plenty of spotify api implementations on npmjs.org.

    Use arunoda's npm package for integrating npm packages in your meteor application

    0 讨论(0)
提交回复
热议问题