-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
problem understanding login requirements #2
Comments
My findings are as follows:
now i am stuck, any help from someone? |
Invalid client issue is fixed, version 0.3.4 on PyPI also includes templates folder |
Hi, thanks for your project.
Some time ago I wrote a replacement scrobbler for Sonos written using Python 2, and accessing Sonos units via subscribing to their UPnP events.
I am looking at redeveloping this app using Python 3, and the official Sonos api.
I am interested in your project as it allows me to test concepts and the Sonos api, as well as being for ongoing use with my Sonos equipment.
I have installed sonos_cli, but am failing somewhere trying to match Sonos documentation and your documentation.
I supply info to sonos_cli to your set_config function as:
Then run your login function;
copy of debug log attached bellow
Am I correctly understanding what data is required by SONOS_CLIENT_ID and SONOS_CLIENT_SECRET?
I don't think that I have any other Sonos "ID", other than my Household ID, but doubt that it would be attached the "secret" for the Sonos Integration.
Also what should have I done for "Redirect URIs" and "Event Callback URL" in my Credentials tab at https://integration.sonos.com/integrations ?
For Redirect URIs I added http://localhost:5000 after reading your settings.py module
One other thing that I have noticed is I downloaded your app as sonos-cli-0.3.1.tar.gz
So I manually installed using the above file that I downloaded ... It seemed to be missing the templates directory, and the two html files, from within sonos-cli 0.3.1\sonos\commands.
my debug log; I have redacted my client ID and secret
ready to start
click imported
sonos.commands imported
Please enter Sonos application ID:
Successfully configured Sonos CLI.
DEBUG:requests_oauthlib.oauth2_session:Generated new state cGCWLh3OSDIysqk69reZSAGHK79CcU.
DEBUG:requests_oauthlib.oauth2_session:Encoding
client_id
"xxxxx" withclient_secret
as Basic auth credentials.DEBUG:requests_oauthlib.oauth2_session:Requesting url https://api.sonos.com/login/v3/oauth/access using method POST.
DEBUG:requests_oauthlib.oauth2_session:Supplying headers {'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'} and data {'grant_type': 'authorization_code', 'code': 'a640d904-9acc-46e7-b3a7-b7953a50ecd1', 'redirect_uri': 'http://localhost:5000', 'username': 'xxxxx', 'password': 'yyyyy'}
DEBUG:requests_oauthlib.oauth2_session:Passing through key word arguments {'json': None, 'timeout': None, 'auth': <requests.auth.HTTPBasicAuth object at 0x000002053C781668>, 'verify': True, 'proxies': None}.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.sonos.com:443
DEBUG:urllib3.connectionpool:https://api.sonos.com:443 "POST /login/v3/oauth/access HTTP/1.1" 401 26
DEBUG:requests_oauthlib.oauth2_session:Prepared fetch token request body grant_type=authorization_code&code=a640d904-9acc-46e7-b3a7-b7953a50ecd1&redirect_uri=http%3A%2F%2Flocalhost%3A5000&username=xxxxx&password=yyyyy
DEBUG:requests_oauthlib.oauth2_session:Request to fetch token completed with status 401.
DEBUG:requests_oauthlib.oauth2_session:Request headers were {'User-Agent': 'python-requests/2.21.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', 'Content-Length': '206', 'Authorization': 'Basic MDg0YWU5ODktNzMyOS00NmE4LWJlMTMtMjRkZDNlZjM5MjJiOg=='}
DEBUG:requests_oauthlib.oauth2_session:Request body was grant_type=authorization_code&code=a640d904-9acc-46e7-b3a7-b7953a50ecd1&redirect_uri=http%3A%2F%2Flocalhost%3A5000&username=xxxxx&password=yyyyy
DEBUG:requests_oauthlib.oauth2_session:Response headers were {'Content-Type': 'application/json;charset=UTF-8', 'Strict-Transport-Security': 'max-age=31536000 ; includeSubDomains', 'X-Application-Context': 'login-service:prod', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Content-Length': '26', 'Expires': 'Thu, 14 Mar 2019 04:48:07 GMT', 'Cache-Control': 'max-age=0, no-cache, no-store', 'Pragma': 'no-cache', 'Date': 'Thu, 14 Mar 2019 04:48:07 GMT', 'Connection': 'close', 'Set-Cookie': 'JSESSIONID=954C4663CEAE7E6DA30B15C149E475D0; Path=/login/v3; Secure; HttpOnly, AWSELB=69BFEFC914A689BF6DC8E4652748D7B501ED60290D7EA60FC919515B6A74C4FF1FE8CC8DE4ABBF19CF0BCF4D50224AD32883861ABF2DB40F64EDDC685ADCEABCFAE6CDCBCD;PATH=/;MAX-AGE=1800'} and content {"error":"invalid_client"}.
DEBUG:requests_oauthlib.oauth2_session:Invoking 0 token response hooks.
xxxxx
yyyyy
Traceback (most recent call last):
File "cli.py", line 38, in
login()
File "D:\My Documents\Python\sonos-cli 0.3.1\sonos\commands\login.py", line 66, in login
data = _get_access_token(code)
File "D:\My Documents\Python\sonos-cli 0.3.1\sonos\commands\login.py", line 20, in _get_access_token
return auth.get_access_token(code)
File "D:\My Documents\Python\sonos-cli 0.3.1\sonos\api\auth.py", line 16, in get_access_token
return client.fetch_token(ACCESS_TOKEN_URL, code=code, username=SONOS_CLIENT_ID, password=SONOS_CLIENT_SECRET)
File "c:\Program Files\Python37\lib\site-packages\requests_oauthlib\oauth2_session.py", line 307, in fetch_token
self._client.parse_request_body_response(r.text, scope=self.scope)
File "c:\Program Files\Python37\lib\site-packages\oauthlib\oauth2\rfc6749\clients\base.py", line 415, in parse_request_body_response
self.token = parse_token_response(body, scope=scope)
File "c:\Program Files\Python37\lib\site-packages\oauthlib\oauth2\rfc6749\parameters.py", line 425, in parse_token_response
validate_token_parameters(params)
File "c:\Program Files\Python37\lib\site-packages\oauthlib\oauth2\rfc6749\parameters.py", line 432, in validate_token_parameters
raise_from_error(params.get('error'), params)
File "c:\Program Files\Python37\lib\site-packages\oauthlib\oauth2\rfc6749\errors.py", line 405, in raise_from_error
raise cls(**kwargs)
oauthlib.oauth2.rfc6749.errors.InvalidClientError: (invalid_client)
Process terminated with an exit code of 1
The text was updated successfully, but these errors were encountered: