Skip to content
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

Error communicating with Renault API #95

Open
timmchugh11 opened this issue Feb 3, 2021 · 35 comments
Open

Error communicating with Renault API #95

timmchugh11 opened this issue Feb 3, 2021 · 35 comments

Comments

@timmchugh11
Copy link

timmchugh11 commented Feb 3, 2021

Hello,

About 2 days ago my connection stopped working and I get the error,

Error communicating with Renault API!
{"error":"access_denied","error_description":"Unauthorized"}

Is this an issue with pyze? I have tried re adding my credentials and I get the same error when logging in.

I am still able to use the Renault app and the data is up to date, so I don't think it is my account.

Thanks

@epenet
Copy link
Contributor

epenet commented Feb 3, 2021

There was a change of Key on the Renault servers.
There is a discussion about it on hacf-fr/renault-api#181, with corresponding pull request hacf-fr/renault-api#182

@timmchugh11
Copy link
Author

Thank you, I just used the new key and all is working again

The key I used from the link you sent, Ae9FDWugRxZQAGm3Sxgk7uJn6Q4CGEA2

@yannickh
Copy link

yannickh commented Feb 8, 2021

Hmm, I got it working again with the new key, but it seems to have broken again?

Error message seems to be slightly different though. When using the new key (mentioned above), I get this error:
{"type":"FUNCTIONAL","messages":[{"code":"err.func.wired.unauthorized","message":"The access is unauthorized"}],"errors":[{"errorCode":"err.func.wired.unauthorized","errorMessage":"The access is unauthorized"}],"error_reference":"FUNCTIONAL"}

While when I use a different/incorrect key, I get this error:
{"error":"access_denied","error_description":"Unauthorized"}

Any ideas?
The My Renault app on my phone still functions correctly...

@db-EV
Copy link

db-EV commented Feb 8, 2021

Problem maybe related to #78?

@epenet
Copy link
Contributor

epenet commented Feb 8, 2021

Note: https://github.com/hacf-fr/renault-api still works, but in my case the data hasn't changed since 2021-02-07T12:17:58+01:00 and no longer reflects the reality.

@db-EV
Copy link

db-EV commented Feb 8, 2021

Ok, I found the problem in EVCC code. Was not a problem on Renaults side...
So API (with updated Kamereon key) still works fine here. After vehicle wakeup the data was updated correctly.

Yes, it seems to be some faulty Gigya integrations out there.

@fungus75
Copy link

fungus75 commented Feb 8, 2021

Ok, I found the problem in EVCC code. Was not a problem on Renaults side...
So API (with updated Kamereon key) still works fine here. After vehicle wakeup the data was updated correctly.

Yes, it seems to be some faulty Gigya integrations out there.

Starting with today 12:00 CET gigya changed (or never accepted) some parameter-names. See (sorry german) fungus75/ioBroker.zoe2#17 or have a look at the implementation of the gigya-part here: https://github.com/hacf-fr/renault-api/issues

@fungus75
Copy link

fungus75 commented Feb 8, 2021

Please find here which parameter I had to adjust: fungus75/ioBroker.zoe2@c787fda

@db-EV
Copy link

db-EV commented Feb 8, 2021

And calling account.getAccount is unnecessary, it's enough with accounts.login and accounts.getJWT.
You get the needed gigyaPersonID already on login.

@db-EV
Copy link

db-EV commented Feb 8, 2021

And it was not the case for pyze either, there are other scripts, apps and so on with faulty Gigya integration.

@kozmoz
Copy link

kozmoz commented Feb 9, 2021

So what's the fix to have pyze working again? Obviously some people digged into the problem.

@yannickh
Copy link

yannickh commented Feb 9, 2021

In the Gigya calls (getAccountInfo and getJWT), the parameter "oauth_token" should be changed to "login_token".

@epenet
Copy link
Contributor

epenet commented Feb 9, 2021

So what's the fix to have pyze working again? Obviously some people digged into the problem.

@kozmoz you don't describe your problem so it might not be linked to this discussion

In the Gigya calls (getAccountInfo and getJWT), the parameter "oauth_token" should be changed to "login_token".

@yannickh it is already the case in pyze since #79 was merged last year

@kozmoz
Copy link

kozmoz commented Feb 9, 2021

So what's the fix to have pyze working again? Obviously some people digged into the problem.

@kozmoz you don't describe your problem so it might not be linked to this discussion

Exactly the same error as @timmchugh11 who started this issue.

Error communicating with Renault API!
{"error":"access_denied","error_description":"Unauthorized"}

@premultiply
Copy link

You need to update the Kamereon API key!!!

@kozmoz
Copy link

kozmoz commented Feb 9, 2021

Alright. Missed the new key for Kamereon, but did update the Gigya API key.
In summary, this fixed my issue:

export KAMEREON_API_KEY="Ae9FDWugRxZQAGm3Sxgk7uJn6Q4CGEA2"
export GIGYA_API_KEY="3_e8d4g4SE_Fo8ahyHwwP7ohLGZ79HKNN2T8NjQqoNnk6Epj6ilyYwKdHUyCw3wuxz"

@brusch
Copy link

brusch commented Feb 11, 2021

I'm still facing issues:

Traceback (most recent call last):
  File "/opt/bin/pyze", line 8, in <module>
    sys.exit(main())
  File "/volume1/Share/Web/SmartHome/.local/lib/python3.8/site-packages/pyze/cli/__main__.py", line 69, in main
    parsed_args.func(parsed_args)
  File "/volume1/Share/Web/SmartHome/.local/lib/python3.8/site-packages/pyze/cli/status.py", line 35, in run
    v = get_vehicle(parsed_args)
  File "/volume1/Share/Web/SmartHome/.local/lib/python3.8/site-packages/pyze/cli/common.py", line 24, in get_vehicle
    vehicles = k.get_vehicles().get('vehicleLinks')
  File "/volume1/Share/Web/SmartHome/.local/lib/python3.8/site-packages/pyze/api/credentials.py", line 26, in inner
    return func(*args, **kwargs)
  File "/volume1/Share/Web/SmartHome/.local/lib/python3.8/site-packages/pyze/api/kamereon.py", line 114, in get_vehicles
    self.get_account_id(),
  File "/volume1/Share/Web/SmartHome/.local/lib/python3.8/site-packages/pyze/api/kamereon.py", line 73, in get_account_id
    accounts = self.get_accounts()
  File "/volume1/Share/Web/SmartHome/.local/lib/python3.8/site-packages/pyze/api/credentials.py", line 25, in inner
    raise MissingCredentialException(name)
pyze.api.credentials.MissingCredentialException: gigya-person-id

any ideas?

@Podariss
Copy link

Podariss commented Feb 12, 2021

Same here;

pi@TestPi:~/pyze$ pyze status --km

Traceback (most recent call last):
File "/usr/local/bin/pyze", line 11, in
load_entry_point('PyZE==0.5.0', 'console_scripts', 'pyze')()
File "/usr/local/lib/python3.5/dist-packages/PyZE-0.5.0-py3.5.egg/pyze/cli/main.py", line 69, in main
File "/usr/local/lib/python3.5/dist-packages/PyZE-0.5.0-py3.5.egg/pyze/cli/status.py", line 35, in run
File "/usr/local/lib/python3.5/dist-packages/PyZE-0.5.0-py3.5.egg/pyze/cli/common.py", line 24, in get_vehicle
File "/usr/local/lib/python3.5/dist-packages/PyZE-0.5.0-py3.5.egg/pyze/api/credentials.py", line 26, in inner
File "/usr/local/lib/python3.5/dist-packages/PyZE-0.5.0-py3.5.egg/pyze/api/kamereon.py", line 119, in get_vehicles
File "/usr/local/lib/python3.5/dist-packages/PyZE-0.5.0-py3.5.egg/pyze/api/credentials.py", line 26, in inner
File "/usr/local/lib/python3.5/dist-packages/PyZE-0.5.0-py3.5.egg/pyze/api/gigya.py", line 109, in get_jwt_token
File "/usr/local/lib/python3.5/dist-packages/PyZE-0.5.0-py3.5.egg/pyze/api/gigya.py", line 126, in raise_gigya_errors
RuntimeError: Gigya returned error 403007: Invalid namespace 'accounts' or method 'getJWT' or you do not have the required permissions to call it.

Used the mentioned api keys from above and from keys mentioned in the readme files

@db-EV
Copy link

db-EV commented Feb 12, 2021

Are you using the correct Gigya API keys for your country? These are different for each country.
Only the Kamereon API key is static for all countries.

@Podariss
Copy link

I used the GB version before, but even with nl_NL no change...

@berti2911
Copy link

Hi, i had the same issue and now it workes with the keys of kozmos.
Then i played a bit with the keys. Here are my results: the Gigya-key is not so strikt, for me also the english and the german version worked:
English

	"gigyaProd": {
		"target": "https://accounts.eu1.gigya.com",
		"apikey": "3_e8d4g4SE_Fo8ahyHwwP7ohLGZ79HKNN2T8NjQqoNnk6Epj6ilyYwKdHUyCw3wuxz"

German

    "gigyaProd": {
        "target": "https://accounts.eu1.gigya.com",
        "apikey": "3_7PLksOyBRkHv126x5WhHb-5pqC1qFR8pQjxSeLB6nhAnPERTUlwnYoznHSxwX668"

but the Kamereon Key is bitchy: neither the german nor the english version was successfull. Here i got the error message:

"Error communicating with Renault API!
{"error":"access_denied","error_description":"Unauthorized"}"

Only the Kammereon key of kozmos worked. So a question to him: how did you get this key?

@epenet
Copy link
Contributor

epenet commented Feb 12, 2021

Key retrieval has changed on the Renault side.
It is now hidden deep inside Firebase, and for now you need to use Fiddler to extract it.

There is a discussion on hacf-fr/renault-api#184

@berti2911
Copy link

@Podariss, @brusch: maybe it helps to delete first the lokal file .credentials/pyze.json before starting again with pyze login?

@kozmoz
Copy link

kozmoz commented Feb 12, 2021

Only the Kammereon key of kozmos worked. So a question to him: how did you get this key?

In the third message of this thread. Initially I also missed that one, but later I realised that was the fix for access_denied.

#95 (comment)

@heckmic
Copy link

heckmic commented Feb 22, 2021

Same Problem here:

Traceback (most recent call last): File "/usr/local/bin/pyze", line 11, in <module> load_entry_point('PyZE==0.5.0', 'console_scripts', 'pyze')() File "/usr/local/lib/python3.7/dist-packages/PyZE-0.5.0-py3.7.egg/pyze/cli/__main__.py", line 69, in main File "/usr/local/lib/python3.7/dist-packages/PyZE-0.5.0-py3.7.egg/pyze/cli/status.py", line 35, in run File "/usr/local/lib/python3.7/dist-packages/PyZE-0.5.0-py3.7.egg/pyze/cli/common.py", line 24, in get_vehicle File "/usr/local/lib/python3.7/dist-packages/PyZE-0.5.0-py3.7.egg/pyze/api/credentials.py", line 25, in inner pyze.api.credentials.MissingCredentialException: kamereon-api-key

@berti2911
Copy link

@heckmic: Did you use exactly the following KEY? Only this one worked for me.
export KAMEREON_API_KEY="Ae9FDWugRxZQAGm3Sxgk7uJn6Q4CGEA2"

And of course you have to login again: pyze login

@jumpjack
Copy link

I am using the updated key Ae9FDWugRxZQAGm3Sxgk7uJn6Q4CGEA2 , but I am still getting this error:

{"type":"FUNCTIONAL","messages":[{"code":"err.func.wired.unauthorized","message":"The access is unauthorized"}],"errors":[{"errorCode":"err.func.wired.unauthorized","errorMessage":"The access is unauthorized"}],"error_reference":"FUNCTIONAL"}

I am using both direct url call and GET/POST using a Rest API Chrome extension, no luck.

My direct link:
https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/persons/MY_PERSON_ID?apikey=Ae9FDWugRxZQAGm3Sxgk7uJn6Q4CGEA2&x-gigya-id_token=MY_JWT_TOKEN&country=IT

@jumpjack
Copy link

I also know that there is a direct link which gives a very long JSON response, containing a lot of data, including my VIN.... but I found it by chance after dozens of attempts and I cannot get it anymore, any idea how it could be formed?

@berti2911
Copy link

Are you using pyze? If not maybe you could download this library and look in the code how the web-service or link is formed.
For pyze it is essential to delete first the file .credentials/pyze.json and then login again with "pyze login" to avoid old chaching.

@jumpjack
Copy link

Indeed I am reverse-engineering pyze and other scripts to figure out which are the direct calls to perform, to implement them in Javascript, but I am stuck at Kamereon authentication (Gigya part is fine).

@fungus75
Copy link

Have a look at that: https://github.com/fungus75/ioBroker.zoe2/blob/master/main.js
Rewritten pyze (and some more projects) in Javascript for usage within iobroker.
Maybe it helps?

@jumpjack
Copy link

@AllanPetersenDK
Copy link

AllanPetersenDK commented Apr 22, 2023

LoginID and password for GIGYA is My renault app login?
When trying to do the Download Kamereon Person Id (PersonId) i get this error.
{
"errorDetails": "Unauthorized user",
"errorMessage": "Unauthorized user",
"apiVersion": 2,
"statusCode": 403,
"statusReason": "Forbidden",
"time": "2023-04-22T06:40:45.003Z"
}

@jumpjack
Copy link

I think the APi key has just changed again, breaking all the custom apps.

@jumpjack
Copy link

This should be the new kamereon api key:

YjkKtHmGfaceeuExUDKGxrLZGGvtVS0J

Source: https://gist.github.com/mountbatt/772e4512089802a2aa2622058dd1ded7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests