Postman OAuth 2.0 guide for Västtrafik API

We are currently working on evaluating the API for public transportation data and journey planing in the Gothenburg and west-coast area of Sweden. We used the API client Postman to access the transportation data. The current guide for the API portal is only in Swedish and we stumbled upon some problem setting up the OAuth 2.0 authentication. Which is why we thought of sharing how to configure the authentication, so you can start exploring the data.

  1. After installing Postman login at the developer Portal at Västtrafik
  2. Create a new application (mina applikation), that you later will use to add API:s to
  3. Under the menu “Mina prenumerationer” (my subscriptions) add the API “Reseledaren V2”, by using the drop-down to select the previous created application
  4. Open Postman and use the OAuth 2.0 for authentication, which you find under the Authorization tab
  5. Reseledaren OAuth 2.0 Step 1Give your token a name in Postman
  6. Copy the URL to the “Access token URL” field, leave the “Auth URL” empty
  7. In the portal go “Mina applikationer” and click maintenance icon named “Hantera nycklar” to manage keys
  8. Copy the API key, “Nyckel” to the Client ID filed in Postman
  9. Copy the API secret key, “Hemlighet” to the Client Secret filed
  10. Add a arbitrary session name the Scope filed in Postman
  11. Set the Grant Type to Client Credentials and uncheck the Request access token locally
  12. It should now look similar to the image below with your Key and Secret Key
  13. Reseledaren OAuth 2.0 Step 2Click the Request Token button to obtain a token
  14. Click the newly obtained token you created and click the Use Token button Reseledaren OAuth 2.0 Step 3
  15. To access the data, start copy the URL endpoints for the API you want to use, which you find under “Mina prenumerationer” and choose the API “Reseledaren V2”, then under “API-konsol”

Leave a Reply