jamesremuscat / pyze

Unofficial Python client and API for Renault ZE
MIT License
111 stars 29 forks source link

Auth succeeds, but unauthorized response #81

Closed cscashby closed 4 years ago

cscashby commented 4 years ago

I've set up the two keys as follows:

Download from https://renault-wrd-prod-1-euw1-myrapp-one.s3-eu-west-1.amazonaws.com/configuration/android/config_en_GB.json (I am in en_GB)

Run export KAMEREON_API_KEY= Run export GIGYA_API_KEY=

Then debug login output: pyze --debug login which gives me:

DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): accounts.eu1.gigya.com:443
DEBUG:urllib3.connectionpool:https://accounts.eu1.gigya.com:443 "POST /accounts.login HTTP/1.1" 200 818
DEBUG:pyze.api.gigya:Received Gigya login response: 
{'callId': 'XXX', 'errorCode': 0, 'apiVersion': 2, 'statusCode': 200, 'statusReason': 'OK', 'time': '2020-08-23T09: 21: 28.627Z',
 'registeredTimestamp': 1524297664, 'UID': 'XXX', 'UIDSignature': 'XXX=', 'signatureTimestamp': '1598174488', 
'created': '2018-04-21T08: 01: 04.597Z', 'createdTimestamp': 1524297664, 'isActive': True, 'isRegistered': True, 
'isVerified': True, 'lastLogin': '2020-08-23T09: 21: 28.557Z', 'lastLoginTimestamp': 1598174488, 'lastUpdated': 
'2019-11-07T10: 39: 40.216Z', 'lastUpdatedTimestamp': 1573123180216, 'loginProvider': 'site', 
'oldestDataUpdated': '2019-11-06T09: 00: 56.642Z', 'oldestDataUpdatedTimestamp': 1573030856642, 
'profile': {'firstName': '', 'lastName': '', 'country': '', 'email': 'renault@cashby.me.uk'
    }, 'registered': '2018-04-21T08: 01: 04.921Z', 'socialProviders': 'site',
'verified': '2018-04-21T08: 02: 03.058Z', 'verifiedTimestamp': 1524297723058, 'newUser': False,
'sessionInfo': {'cookieName': 'XXX', 'cookieValue': 'XXX'
    }
}
DEBUG:urllib3.connectionpool:https://accounts.eu1.gigya.com:443 "POST /accounts.getAccountInfo HTTP/1.1" 200 709
DEBUG:pyze.api.gigya:Received Gigya accountInfo response: 
{'callId': 'XXX', 'errorCode': 0, 'apiVersion': 2, 'statusCode': 200, 'statusReason': 'OK', 
'time': '2020-08-23T09: 21: 28.678Z', 'registeredTimestamp': 1524297664000, 'UID': 'XXX', 
'UIDSignature': 'vbyQRAHWu90jIkpNNgkzPhb29MI=', 'signatureTimestamp': '1598174488', 
'created': '2018-04-21T08: 01: 04.597Z', 'createdTimestamp': 1524297664000, 
'data': {'migrationCode': 'UK_FULL', 'gigyaImportJobID': '06112019', 'personId': 'UUID',
'gigyaDataCenter': 'eu1.gigya.com', 'migrationExternalId': 'ID'
    }, 'preferences': {}, 'emails': {'verified': ['EMAILID'
        ], 'unverified': []
    }, 'isActive': True, 'isRegistered': True, 'isVerified': True, 'lastLogin': '2020-08-23T09: 21: 28.557Z',
 'lastLoginTimestamp': 1598174488000, 'lastUpdated': '2019-11-07T10: 39: 40.216Z', 
'lastUpdatedTimestamp': 1573123180216, 'loginProvider': 'site', 
'oldestDataUpdated': '2019-11-06T09: 00: 56.642Z', 'oldestDataUpdatedTimestamp': 1573030856642, 'profile': {'firstName': '', 'lastName': '', 'country': '', 'email': 'EMAILID'
    }, 'registered': '2018-04-21T08: 01: 04.921Z', 'socialProviders': 'site', 'verified': '2018-04-21T08: 02: 03.058Z', 'verifiedTimestamp': 1524297723058
}
DEBUG:urllib3.connectionpool:https://accounts.eu1.gigya.com:443 "POST /accounts.getJWT HTTP/1.1" 200 950
DEBUG:pyze.api.gigya:Received Gigya getJWT response: 
{'callId': 'ID', 'errorCode': 0, 'apiVersion': 2, 'statusCode': 200, 'statusReason': 'OK', 'time': '2020-08-23T09: 21: 28.749Z', 'ignoredFields': '', 'id_token': 'TOKEN'
}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api-wired-prod-1-euw1.wrd-aws.com:443
DEBUG:urllib3.connectionpool:https://api-wired-prod-1-euw1.wrd-aws.com:443 "GET /commerce/v1/persons/8a9c1051-8f07-4dd4-bd05-587f8ba8bc96?country=GB HTTP/1.1" 403 None
Error communicating with Renault API!
{"error":"access_denied","error_description":"Unauthorized"}
jamesremuscat commented 4 years ago

This sometimes happens; Renault's servers decide to throw a 403 even if you've got authorisation.

You can try logging in again, or just waiting a day and trying again, and it should go away.

The alternative is that one or other of your subscriptions to ZE Services (yes, there are two, because Renault logic) have expired.

I'll close this issue for now since I don't think pyze is doing anything wrong here, but if you're still encountering this in a day or two please feel free to re-open it.

cscashby commented 4 years ago

Sorry, unfortunately it's not gone away. As far as I can tell I am still subscribed. I can log in with the same credentials to the My Renault (after I first saw the error I checked). Do you know of any way I can easily test this?

Thanks in advance