项目作者: rlabausa

项目描述 :
Simplifying the implicit grant authorization flow for developers on Spotify's Web API
高级语言: Python
项目地址: git://github.com/rlabausa/spotify-dev-auth.git
创建时间: 2019-09-14T19:01:34Z
项目社区:https://github.com/rlabausa/spotify-dev-auth

开源协议:MIT License

下载


spotify-dev-auth

This Flask app helps streamline the tedious process of generating a Spotify access token through the Implicit Grant Flow.

Running Locally

To get the app running:

  1. Install the required dependencies:
    1. pip3 install -r requirements.txt
  2. Configure your .env file with the following variables (a .env.example file can be found in the root of the repo):

    • SECRET_KEY: This is required to use FlaskForms and can be generated with Python 3’s os or secrets module.

      • In a Python shell, simply copy the output of either of the following commands into your .env file:

        1. # option 1 - generate key with os module
        2. import os
        3. os.urandom(32)
        4. # option 2 - generate key with secrets module
        5. import secrets
        6. secrets.token_hex(16)
    • CLIENT_ID: This is taken from an existing application in your Spotify developer dashboard (you will need to create one if you don’t already have one).
    • RESPONSE_TYPE='token': The required parameter for obtaining authorization through the Implicit Grant Flow.
    • REDIRECT_URI='http://localhost:5000/auth/callback/': This is the URL/route that is designed to work with this application. It must be white-listed in your application.
  3. (Optional) You can remove or configure the default scope by adding to or removing from the scope variable in the auth view function.
  4. Once everything is configured to your liking, run the application using:
    1. flask run
    From there, you should be able to access the application via browser at http://localhost:5000/. Once you submit the form, it will redirect you to a login page asking to authorize the app to view your account. Once you’ve accepted, it will redirect you to the callback URL where you can copy the access token right off of the HTML page.