Authentication issues
See original GitHub issueI’ve been using the API for two months without any issues, up until a few days ago. There seems to be an issue with the Oauth token fetch.
To make sure the issue isn’t on my side I created a new dummy application as follows:
from unsplash.api import Api
from unsplash.auth import Auth
client_id = "x"
client_secret = "x"
redirect_uri = "urn:ietf:wg:oauth:2.0:oob"
code = "x"
auth = Auth(client_id, client_secret, redirect_uri, code=code)
api = Api(auth)
api.user.me()
Running this code with a fresh authorization code gives the following error:
Traceback (most recent call last):
File "C:\...\Python\Python36-32\lib\site-packages\unsplash\auth.py", line 56, in __init__
self.access_token = self.get_access_token(code)
File "C:\...\Python\Python36-32\lib\site-packages\unsplash\auth.py", line 72, in get_access_token
code=code
File "C:\...\Python\Python36-32\lib\site-packages\requests_oauthlib\oauth2_session.py", line 244, in fetch_token
self._client.parse_request_body_response(r.text, scope=self.scope)
File "C:\...\Python\Python36-32\lib\site-packages\oauthlib\oauth2\rfc6749\clients\base.py", line 411, in parse_request_body_response
self.token = parse_token_response(body, scope=scope)
File "C:\...\Python\Python36-32\lib\site-packages\oauthlib\oauth2\rfc6749\parameters.py", line 379, in parse_token_response
validate_token_parameters(params)
File "C:\...\Python\Python36-32\lib\site-packages\oauthlib\oauth2\rfc6749\parameters.py", line 386, in validate_token_parameters
raise_from_error(params.get('error'), params)
File "C:\...\Python\Python36-32\lib\site-packages\oauthlib\oauth2\rfc6749\errors.py", line 415, in raise_from_error
raise cls(**kwargs)
oauthlib.oauth2.rfc6749.errors.InvalidGrantError: (invalid_grant) The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ".\testauth.py", line 9, in <module>
auth = Auth(client_id, client_secret, redirect_uri, code=code)
File "C:\...\Python\Python36-32\lib\site-packages\unsplash\auth.py", line 59, in __init__
raise UnsplashAuthError(e)
unsplash.errors.UnsplashAuthError: Unsplash Authentication Error: (invalid_grant) The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.
I’m using Python 3.6 and the version of the dependencies specified in the requirements.txt.
Thanks for any help.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:5
Top Results From Across the Web
4 User Authentication Issues Developers and Admins Struggle ...
4 User Authentication Issues Developers and Admins Struggle With (Solved) · 1. Getting Users to Set Strong Passwords · 2. Encouraging Users to ......
Read more >Authentication vulnerabilities | Web Security Academy
The authentication mechanisms are weak because they fail to adequately protect against brute-force attacks. · Logic flaws or poor coding in the implementation ......
Read more >6 persistent enterprise authentication security issues
1. The problems with password authentication. Passwords are by far the most used and most easily subverted method of authentication. Some organizations have ......
Read more >Troubleshoot Authentication Issues - Auth0
Learn where to look for steps to troubleshoot authentication and authorization issues such as API calls, login, logout, user profiles, MFA and SAML....
Read more >The Authentication Problem: Rethinking Passwords
Dan Conrad, security and management team lead at One Identity, shares why passwords are not the best solution to the authentication problem ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anybody still wondering, I wasn’t able to find a solution but ended up using another wrapper that works seamlessly https://github.com/salvoventura/pyunsplash
+1 Any updates @yakupadakli ??