mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 16:15:51 +03:00
[GH-ISSUE #693] 127.0.0.1 sent an invalid response. ERR_SSL_PROTOCOL #410
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#410
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Srijha09 on GitHub (Jun 22, 2021).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/693
I am sort of new to APIs and trying to get myself accustomed with Spotify API with a Flask application. I was able to authenticate with the Spotify Authentication but instead of going to the index.html page I got an ERR_SSL_PROTOCOL error.

I am not able to figure out what went wrong. I gave the correct credentials (client_id, secret), valid redirect URI .
It would be appreciated if someone can help me out on this.
I also tried changing the client_url http://127.0.0.1:5000/callback/q to https://127.0.0.1:5000/callback/q. Just in case that caused the error. Yet ERR_SSL_PROTOCOL error persists
Thanks!
@Peter-Schorn commented on GitHub (Jun 22, 2021):
Please post the code for your web app and the full URL of the page that is shown in the screenshot above.
@Srijha09 commented on GitHub (Jun 22, 2021):
spotify_client.py
` import json
import requests
from urllib.parse import quote
class SpotifyClient:
# Spotify API URLS
API_VERSION = "v1"
SPOTIFY_AUTH_URL = "https://accounts.spotify.com/authorize"
SPOTIFY_TOKEN_URL = "https://accounts.spotify.com/api/token"
SPOTIFY_API_BASE_URL = "https://api.spotify.com"
SPOTIFY_API_URL = f"{SPOTIFY_API_BASE_URL}/{API_VERSION}"
app.py
` #Flask imports
from flask import Flask,Blueprint,request, url_for, session, redirect, render_template
#script imports
from helper.spotifyclient import SpotifyClient
#spotify imports
import spotipy
from spotipy.oauth2 import SpotifyOAuth
import time
import config
import json
import requests
app = Flask(name)
app.secret_key = "rhythmify"
app.config['SESSION_COOKIE_NAME'] = "Rhythmify Cookie"
app.config['TEMPLATES_AUTO_RELOAD'] = True
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
TOKEN_INFO = "token_info"
client_id = config.SPOTIFY_CLIENT_ID
client_secret = config.SPOTIFY_CLIENT_SECRET
app.config['all_sp_objects'] = {}
#---------------------------------HOME PAGE-----------------------------------------
spotify_client = SpotifyClient(client_id, client_secret, port=5000)
@app.route("/", methods=['POST', 'GET'])
def login():
"""
redirect to Spotify's log in page
"""
auth_url = spotify_client.get_auth_url()
return redirect(auth_url)
@app.route("/callback/q")
def callback():
"""
set the session's authorization header
"""
auth_token = request.args['code']
spotify_client.get_authorization(auth_token)
authorization_header = spotify_client.authorization_header
session['authorization_header'] = authorization_header
return redirect(url_for("home"))
@app.route("/home")
def home():
render_template('index.html') `
URL of Screenshot:
https://127.0.0.1:5000/callback/q?code=AQAI_8m09DYhA2yfmaQTvw4Ig5x0nkkz4B2QppXaCfjyLPnrLXBep2D68mkpodFjw2o7tSy1yGhbRn75uq3n-sZJIL8ZfjspIE7Zf0jo75RhO-kaCoqYhHLdpN2tvoieRf38REthFgsSmi1VaHJdAP0UUta4a3_jQAZDRKQa8RP-jTeMUyIXR9VfMXFjOA77mR6UtB1Wgk5gKyf6eI4xKJl8PM4zpU_uIaK2Dpyc-_9z3j56mCP0DRcER0YiuXzwSoze155u7evzjrd17MjeUZEe6-uk_LykVvA0yCRUCAJcFIsDaXBHew
@stephanebruckert commented on GitHub (Jun 22, 2021):
I see you are visiting https instead of http! When working locally, make sure you visit http://127.0.0.1:5000
@Srijha09 commented on GitHub (Jun 22, 2021):
Alright thanks alot!
@IgorAguiar-Giro commented on GitHub (Jan 4, 2024):
I wish my problem was that simple XD