ubahnverleih / WoBike

Documentation of Bike Sharing APIs 🚴🛴🛵
949 stars 131 forks source link

VOI Scooter Info: 401.3 Error #196

Open Tim-Ganther opened 3 years ago

Tim-Ganther commented 3 years ago

Hey,

I followed the instruction and I am able to retrieve and renew my access / authToken. It seems to be working as I can retrieve zone info using it. Unfortunatly I cant retrieve the Scooter Info anymore as the API returns: {'code': '401.3', 'message': 'Unauthorized, Missing required scopes'}

Some days ago it was working fine.

Looks like the Endpoint somehow changed and it now requires a scope. Any ideas?

ricffb commented 3 years ago

Hey Tim,

Here is what I've found out: On the newer versions you need to "activate" your device. This is indicated by the following response from /v2/auth/verify/code (note that this resides in v2 now):

{
    "authToken": "",
    "verificationStep": "deviceActivationRequired"
}

I assume they now correlate exactly one device-id with a phone number (when trying this on my phone and then on postman I had to activate my "device" again).

The activation is pretty simple:

url https://api.voiapp.io/v2/auth/verify/device/activate

Request Headers

x-device-id:  <guid>
x-device-name: <name> (im not sure if its required)

Body

{
  "token": "<token> (this is the same token you got during the verify phone number step)"
}

Response

{
    "authToken": "some long token"
}

using this token you can proceed to get a session token as documented. This fixed the error for me.

Final Thoughts: The error being of scopes might be confusing and could actually mean, that for some reason the tokens are invalid now.

Edit: This seems to only affect the scooter query. I was also able to query zones bot got 401.3 on scooters with the old credentials.

BastelPichi commented 1 year ago

Apparentely activation is only required when u use ur account on multiple devices.