Spotify API非法redirect_uri [英] Spotify API Illegal redirect_uri

查看:148
本文介绍了Spotify API非法redirect_uri的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试完成Spotify开发人员API教程,但是当我尝试访问用户登录页面时,出现此错误.我已经三遍检查代码中的URI是否与MyApplications页面上的URI匹配,但仍然无法正常工作. 这是脚本

I'm trying to progress through the Spotify developer API tutorial but when I try to access the user login page I get this error. I've triple checked that the URI in the code matches the one on MyApplications page but it still won't work. Here's the script,

var express = require('express'); // Express web server framework
var request = require('request'); // "Request" library
var querystring = require('querystring');
var cookieParser = require('cookie-parser');

var client_id = id;
var client_secret = secret;
var redirect_uri = "http://localhost:8888/callback";

错误代码和MyApplications页面的图像

我不确定自己在做错什么,但是我已经检查了好几个小时,有人可以帮忙吗?

I'm not sure what I'm doing wrong but I've been going over it for hours now, can someone help?

推荐答案

您需要您的重定向URI完全相同.您在控制台中注册的URI是 http://localhost:8888/callback/,并带有斜杠.您在代码中使用的版本没有斜杠.只需将您的redirect_uri更改为:

You need your redirect URIs to be exactly the same. The URI you have registered in the Dashboard is http://localhost:8888/callback/ with a trailing slash. The version you use in your code does not have the trailing slash. Just change your redirect_uri to be:

var redirect_uri = "http://localhost:8888/callback/";

您可以验证此示例是否可以使用我授权的URL:

You can verify that this works with this example authorize URL I made: https://accounts.spotify.com/en/authorize?client_id=df5c5a57b94a4817ae3ac4760c701983&redirect_uri=http:%2F%2Flocalhost:8888%2Fcallback%2F&scope=streaming%20user-read-birthdate%20user-read-private%20user-modify-playback-state&response_type=token&show_dialog=true

这篇关于Spotify API非法redirect_uri的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆