Open bgoncal opened 4 weeks ago
This seems to be a problem of stellantis - which also happens to me in the app :-/
The only somehow crazy solution I would come up with, is to update and capture the token/code automatically.
@flobz
have you considered using pytest-playwright
as dependency, running playwright install
somehow and then using a script like this to capture the code?
import re
from playwright.sync_api import Playwright, sync_playwright, expect
from urllib.parse import urlparse, parse_qs
redirect_url=PLEASE_FILL_ME_IN
username=PLEASE_FILL_ME_IN
password=PLEASE_FILL_ME_IN
def handle_request(request):
url = request.url
if url.startswith("mymap://oauth2redirect/"):
parsed_url = urlparse(url)
query_params = parse_qs(parsed_url.query)
code = query_params.get("code", [None])[0]
print("Authorization code captured:", code)
# capture and use the code to continue to OTP
def run(playwright: Playwright, redirect_url, username, password) -> None:
browser = playwright.chromium.launch(headless=False)
context = browser.new_context()
page = context.new_page()
page.on("request", handle_request)
page.goto(redirect_url)
page.get_by_placeholder("E-mail *").fill(username)
page.get_by_placeholder("Mot de passe *").fill(password)
page.get_by_role("button", name="Envoyer").click()
page.get_by_role("button", name="OK").click()
# Wait until the redirect is expected to occur
page.wait_for_timeout(10000)
context.close()
browser.close()
with sync_playwright() as playwright:
run(playwright, redirect_url, username, password)
this is just a test code but might work when integrated properly
I don't know how they get the token but Tronity app connects to PSA and never asked me to reauthenticate
Describe the bug I configure PSA controller, use it for 2 weeks, then it gets logged out. Since now to obtain the token requires to access it from a desktop browser, it is not something I can do from my phone quickly.
Config file Give the anonymize content of the config file
Environment (please complete the following information):
Additional context Add any other context about the problem here.