Tried connecting jira using api with username and profiletoken in password but it returns 401-unauthorized
we connect web ui using sso
Hi @Uncleweb
I think there is some confusion over the terms used here. Personal Access Tokens (PATs) are only used within our Server and Data Center products as explained in Using Personal Access Tokens.
If you happen to be using an Atlassian Cloud site, those instructions should be disregarded. Instead for Atlassian Cloud please see Manage API tokens for your Atlassian account to understand how to create an API token your Atlassian Account can use for our Cloud services. Also the steps in Basic auth for REST APIs are useful for learning the expected means of supplying this token within a header.
@Andy Heinzer thanks for pointing out and I can confirm that this 401 authorized on data center product
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Andy Heinzer After changing "Type" from basic to bearer now I can get 200 OK but in response getting whole html page source code which cantans lot of hyper links along with login page asking username and password.
Any hints?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What endpoint are you calling in your REST request? Perhaps it might help to see the command you are trying to run. But I would recommend that you not post your actual PAT or your actual URL here in Community, as this is a public site.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here are the details I am using in order to connect
endpoint: https://jira.abc.mycompanydomain.com/rest/api/3/issue
Headers: Content-Type / application/json
body of request
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Based on the response of the login page, it looks like your authorization is failing. The payload looks like you're trying to do a POST to that endpoint. While you can start there, I tend to suggest trying to do a GET from that endpoint of a known existing issue that your account has access to. This tends to be a bit easier to make sure that you can get back the expected output before trying to create a new issue.
I recommend trying to follow the steps in https://developer.atlassian.com/server/jira/platform/basic-authentication/ to encode your credentials in the base64 string and then pass that encoded string as part of an authorization header. If this is done correctly, you should get back the issue details in a json format.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Andy Heinzer
I have check with get and its working and I could see the ticket detail in response
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Welcome to the community @Uncleweb !
Which app you are using? Postman? Are you also using a programming language to fetch data?
Make sure that for your username you use your email and for the password that you are using the Jira API token.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nikola Perisic I am using postman and I am using my mail id and Jira api token
do you think it could be that some restriction at jira is not letting me call api?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am using Postman as well, and for authorization I am using the Basic Auth. Are you using the same auth type?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have tried it with my test account and it works but not for my work jira hence curious if there are config which let us block users to connect using api
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Understood. I have the rate limiting for API, but this is more blocking the users to use the API at all. I would see what others from community think about this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I added additional tags for wider visibility.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.