Api authorisation

API Documentation I am trying to follow the instructions here and this step fails.. A shame, anybody has correct instructions?
API V4 - Curl image key in documentation - #3 by Vitor21

  curl https://graph.mapillary.com/token \
      -H "Content-Type: application/json" \
      -H "Authorization: OAuth CLIENT_SECRET" \
      -d'
  {
      "grant_type": "authorization_code",
      "code": "LONG_AUTHORIZATION_CODE",
      "client_id": CLIENT_ID
  }'
  

{
“error”: {
“message”: “Invalid OAuth 2.0 Access Token”,
“type”: “MLYApiException”,
“code”: 190,
“error_data”: {},
“fbtrace_id”: “AueK-WpDg9DQ4tTDnANWMFT”
}
}

Works for me. Did you register your app (client)? Did you use your app’s client secret?

curl https://graph.mapillary.com/token
-H “Content-Type: application/json”
-H “Authorization: OAuth CLIENT_SECRET” \ from dev console
-d’
{
“grant_type”: “authorization_code”,
“code”: “LONG_AUTHORIZATION_CODE”, \from url redirects
“client_id”: 1234 \ from dev console
}
Mapillary doesnt have actual support of any kind?

https://graph.mapillary.com/token ?-H=“Content-Type: application/json”&-H="Authorization:“MLY|2…30”&-d={ “grant_type”: “authorization_code”, “code”: “A … Q”, “client_id”: “28…4”}

There’s no need to go through the authentication flow if you want to access the Mapillary API. You can simply use the “Client Token” from the app you create in Mapillary and use it as the access_token parameter when making API requests.

Did you format the Authorization header correctly?

Authorization: OAuth MLY|2…30

If i try with client token i get error below, i fixed the typo pointed out above still no luck.

{‘error’: {‘message’: ‘Service temporarily unavailable’, ‘type’: ‘MLYApiException’, ‘is_transient’: True, ‘code’: 2, ‘fbtrace_id’: ‘AU-fBHcLpHRhSvCh3NEEjEQ’}}
Traceback (mo

Client Token works for Download Mapillary images with API v4 · GitHub, i still would want to use it in header

If you are having difficulties to properly format cli parameters and invoke curl you can also get your personal user OAuth access token by:

  1. Clear the mapillary.com cookie in your browser or log out from Mapillary
  2. Open the developer tools in your browser
  3. Log in to https://www.mapillary.com/app
  4. Search the “Network log” for the POST request to https://graph.mapillary.com/login?access_token=MLY|4223665974375089|d62822dd792b6a823d0794ef26450398
  5. Examine the response of 4. Your OAuth token should be in
    {"access_token":"MLY…","user_id":"your user id"}
    

Note that this OAuth token is tied to the Mapillary web app client (MLY|4223665974375089|d62822dd792b6a823d0794ef26450398) only and it is going to become invalid once you log out or in again.

1 Like