Skip to content

Problem obtaining an Access Token for AU Client #83

@danricho

Description

@danricho

Describe the bug
I don't appear to be getting a sufficient response as part of the .get_user_access_token() call.

Traceback (most recent call last):
  File "/sandpit/ford/test.py", line 4, in <module>
    access = client.get_user_access_token('<myusername>', '<mypw>')  # Fetch client access token
  File "/sandpit/ford/venv/lib/python3.9/site-packages/connectedcar/connectedcar.py", line 65, in get_user_access_token
    authURL = self.web_session(pkce_code)
  File "/sandpit/ford/venv/lib/python3.9/site-packages/connectedcar/connectedcar.py", line 120, in web_session
    authURL = re.findall('data-ibm-login-url="(.*)"\s', response.text)[0]
IndexError: list index out of range

I have also looked at what I'm getting in response.text and it appears to be a "problem" webpage... I suspect this is may be due to the fact that I'm in Australia. I've also confirmed both on the Ford Australia website and on the FordPass iOS app that my account isn't locked or anything like that.

To Reproduce - This is the script.

import connectedcar

client = connectedcar.AuthClient('9fb503e0-715b-47e8-adfd-ad4b7770f73b', None, None, None, 'AU')
access = client.get_user_access_token('<myusername>', '<mypw>')  # Fetch client access token
user = connectedcar.User(access['access_token'], 'AU') # New User Object

vehicles = user.vehicles()  # Fetch list of user vehicles

for userVehicle in vehicles:  # For each user vehicle
    vehicle = connectedcar.Vehicle(
        userVehicle['vin'], access['access_token'])  # Create vehicle object
    print(vehicle.details())  # Print vehicle details in json format

Expected behavior
Successfully get an access token!

Desktop:

  • OS: Debian
  • Python 3.9.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions