Access Denied error 401 from Code C# or API Explorer


#1

Hello All,

I am trying to code my first C# application to consume data end points, I followed all instructions and wrote the code which kept giving me “401 Access Denied” error despite trying to put authentication headers using different formats, the API explorer as well that don’t work usually from the first time, as it redirects me to the home page while testing but after several trails it kept giving me “Access Denied Error”, I’ve tried consuming any of the services which I have permission on under my application using 1- API Key or 2- OAuth and both gave me the same message
below are the detailed steps for what I did, and also attached a screen shot, I want to know what am I doing wrong here? I want first to let it work over API explorer in which ill take it from there to make it work under my application

  1. sign in
  2. create an app
  3. add the APIs you need for that app
  4. go to API Explorer
  5. choose the API and App/API Key
  6. Choose OAuth2 as the auth type
  7. Choose Client Credentials
  8. API Key and Shared secret are prepopulated for you
  9. Type in “user” to the Scope
  10. add in the Token Endpoint (use this one https://api.transport.nsw.gov.au/auth/oauth/v2/token5 if you don’t have one)
  11. Choose the API endpoint
  12. Click on Submit
  13. Grab the curl command and run it


#2

Resolved in http://opendata.transport.nsw.gov.au/forum/t/can-not-authorize-api-while-using-all-correct-information-can-you-help-me/365