Hello,
I am using Jira under ravmesser.atlassian.net and trying to use the api to pull and process data from a website, but still unable to do so.
I have tried in a few ways:
- tried using the connector, by including https://ravmesser.atlassian.net/atlassian-connect/all-debug.js
When the page loads I get the following errors:
all-debug.js:3174 Uncaught TypeError: Cannot read property 'sizeToParent' of undefined
at all-debug.js:3174
at all-debug.js:3247
(anonymous) @ all-debug.js:3174
(anonymous) @ all-debug.js:3247
(index):37 Uncaught TypeError: Cannot read property 'require' of undefined
at (index):37
- tried performing an api call from the browser where I am logged in to ravmesser.atlassian.net
Browsed to the following url: https://jira.atlassian.com/rest/api/2/project
- tried performing an api call using basic authentication
Create key string, then accessed https://jira.atlassian.com/rest/api/2/project via Postman with the credentials. Got Unauthorized response. The same when I attempted curl request.
Could anyone help me connect to the api?
Kind regards,
Mati Skiba
Hello @mati skiba! Welcome to the community.
Did you follow the 'atlas-connect' tutorial (https://developer.atlassian.com/cloud/jira/platform/build-a-jira-app-using-a-framework/) on your way to this situation or did you put your own auth system in place?
If you put together your own, would you mind sharing some of your code (jsBin or code pen of some sort) to get a better look at what can be happening.
Hello again @mati skiba!
Here is a little example of a node app (can be replicated easily on your website if you want) following the Basic Auth guide (https://developer.atlassian.com/cloud/jira/platform/jira-rest-api-basic-authentication/):
https://github.com/ferborva/jira-basic-api
This is the part you will be interested in comparing with your code:
...
// Atlassian API token - Obtained from id.atlassian.net // My username - complete email. ie. xxxx@domain.com // Atlassian domain where my Jira Cloud instance lives. ie. <domain>.atlassian.net const token = process.env.API_TOKEN; const username = process.env.USERNAME; const domain = process.env.DOMAIN; const encoded = btoa(username+':'+token) // console.log(encoded) // == Fetch from the Jira Cloud projects API endpoint == fetch(`https://${domain}.atlassian.net/rest/api/2/project`, { headers: { 'Authorization': `Basic ${encoded}` } }, ....
If you have any more doubts let me know or you can open a issue in the repo. 👍
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Fernando Bordallo, thank you for you answer.
The tutorial is not relevant for me. I am not trying to create a Jira app, but simply to access the Jira API through a website (only client side, no server side code). Can you direct me in how to do it?
Kind regards,
Mati
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are already trying to do it the right way, but it seems your authentication is failing. That means you are doing that incorrectly, and need to fix that. Looking for access in other ways isn't going to help.
What are you doing differently to what the documentation says about doing basic authentication?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.