When spotify redirects the browser to localhost, serve the page with a
simple http server implemented by HTTPServer. By this way, we can obtain
the tokens the oauth service want so provide us, and no need to input the
user the redirect URL.
This method only works when the application in spotify developer dashboard
is configured to redirect the requests to localhost.
To use this method it is required to specify the redirect_url pointing to
localhost with simple http, to a non-privilegized port (unless the script is
run as root).
which show up when fetching access token using:
```python
credentials = oauth2.SpotifyClientCredentials(
client_id=client_id,
client_secret=client_secret,
)
token = credentials.get_access_token()
```
* Auto-refresh AuthCode flow token.
* Reformatted.
* Reformatted.
* Removed invalid syntax.
* Removed abstract class SpotifyAuthManager.
* Fix typo on docstrings.
* Optionally try to fetch main input parameters from environment.
Implements the capability of trying to fetch the following parameters from the environment, when they're not directly passed to the authorization handler.
The affected parameters are: client_id, client_secret, redirect_uri.
An SpotifyOauthError is raised if no value gets found.
* Removed f-string for Python2 compatibility.
* Fix line-too-long.
* Remove useless import.
* Add username to docstring.
* Remove redundant return.
* Fix empty lines print statement for backward compatibility with Python2.
* Update simple4 example.
* Set optional 'as_dict' parameter on OAuth 'get_access_token'.
* Update changelog.
Co-authored-by: Stéphane Bruckert <stephane.bruckert@gmail.com>
* Linting of OAuth2 mod. + update tests to detect core package path
* Tweak imports in tests + update tox ini to ignore Flake8 E501 error
* Tweak tox ini - ignore examples
* Remove `f`-string from OAuth2 mod.
* More import tweaks in core package + tests
* Update flake8 config. in tox ini - set line length limit to 99 chars.
* auto-refresh user token
* example for a long-running user-request app
* wrap long lines
* combine duplicate code into _refresh_token_if_expired method
* add changelog entry
Optional. Whether or not to force the user to approve the app again if they’ve already done so. If false (default), a user who has already approved the application may be automatically redirected to the URI specified by redirect_uri. If true, the user will not be automatically redirected and will have to approve the app again.
From https://developer.spotify.com/web-api/authorization-guide/
Make is_token_expired_public on SpotifyClientCredentials and SpotifyOAuth.
This method is useful for checking whether tokens that have been stored in cookies etc have timed out. So it's useful for library users to have access to it.
Refactor common implementation of is_token_expired