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

I keep getting logged out after 2 weeks #986

Open
bgoncal opened this issue Oct 27, 2024 · 2 comments
Open

I keep getting logged out after 2 weeks #986

bgoncal opened this issue Oct 27, 2024 · 2 comments

Comments

@bgoncal
Copy link

bgoncal commented Oct 27, 2024

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):

  • OS: Linux/docker
  • Brand and model of car: Peugeot e208
  • Application version (commit number, branch or tag): 3.5.3
  • Log from http://server_address:port/log and browser console log

Additional context
Add any other context about the problem here.

@schuellerf
Copy link

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

@bgoncal
Copy link
Author

bgoncal commented Nov 5, 2024

I don't know how they get the token but Tronity app connects to PSA and never asked me to reauthenticate

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

2 participants