401 error message

I am attempting to do first API and receiving error message statusCode": 401, "message": "The required Authorization header was missing or invalid, or the token has expired". I am running a test connection and I have the authorization set to "No auth" and the authorization subscription key and the BB-API-subscription key matches.


I having trouble figuring out why I am getting this error.


Thanks,

Mohammed

Comments

  • Hello Mohammed,


    How are you attempting to access the API? Are you using an HTTP request through a coding language or are you utilizing service references in C#/VB? What type of API are you attempting to access, REST or SOAP?
  • Michael Tims
    Michael Tims Blackbaud Employee
    Seventh Anniversary Kudos 2 Name Dropper Participant
    Hi Mohammed Abdulkadir‍ . Are you testing the API using the SKY API Console? If so, you will have to select an authorization type from the dropdown. Don't leave it set to "No auth" or you will receive the "401 Unauthorized" error. More instructions on how to practice making API calls using the SKY API Console can be found at https://developer.blackbaud.com/skyapi/docs/getting-started/learn-api


    Thanks!

    -Michael
  • Hi Michael,


    Yes, I am using SKY API Console. First I tried with an authorization type but didn't work so I changed to "No auth".


    I figured out what the issue is. I was using Safari browser and it was not generating the authorization in the "Header" section as well as the Access token. When I tried using Chrome from another computer, the Authorization and Access token was generated automatically and I was able to get a response status with 200 OK.


    I didn't see in the documentation saying don't use Safari browser in the documentation section. Does this means that you can't use Safari when testing the API using SKY API Console?


    Thanks,

    Mohammed
  • Michael Tims
    Michael Tims Blackbaud Employee
    Seventh Anniversary Kudos 2 Name Dropper Participant
    > Does this means that you can't use Safari when testing the API using SKY API Console?

    Mohammed Abdulkadir‍ I'm not aware of any known issues with the SKY API Console and the Safari browser. Perhaps there's some security enabled in your Safari settings that's preventing the Authorization header from updating correctly in the console app. You could check to see if any errors are printed to the browser console, or run a tool like Fiddler (I believe Fiddler is available on macOS now) to observe any network traffic issues.

Categories