First time user of the API having issue with Authorization. I am creating an app for custom integration with HubSpot. I have a 3LO application using OAuth 2 Authorization through Laravel PHP. The authorization appears to work, I get an auth token and refresh token and I can query https://api.atlassian.com/oauth/token/accessible-resources using the auth token and get data back stating my domain name, scopes etc. Whenever I try to call any endpoint for version 2 or 3 of the REST API on https://{mydomain}.atlassian.net/rest/api/3/ I get a 401 unauthorized. I have tried myself, projects, webhook and they all return a 401 error. I am using the same headers as for the call to api.atlassian.com but no joy. Is there some configuration that I have maybe missed? What should I do to troubleshoot this? Any help is greatly appreciated.
Hi @MatthewAllen ,
It looks like you’re constructing the URL with the wrong base URL. Rather than:
https://{mydomain}.atlassian.net/{endpoint-path}
try:
https://api.atlassian.com/ex/jira/{cloudid}/{endpoint-path}
Regards,
Dugald
Thank you so much!! I just re-read the 3LO OAuth and saw that the urls are different than normal rest API. Thanks for bringing to my attention, show why more careful reading is important!!
One other related query. The auth screen shows that I have scope to look at myself but when I try to call the /rest/3/myself endpoint it says that I don’t have the scope to do that. Do I need to specifiy a scope in the auth url to get access to this?
Hi @MatthewAllen ,
I’m not sure about your next question and being buried here, others may not see it to help you so can you post it as a separate question and include details about the auth screen and scope you’re referring to.
Regards,
Dugald