Validate user in Jira with Python

Watson Vieira da Rocha November 30, 2020

Good afternoon, could someone help me? How do I validate the user in Jira ? I'm using Python, below is my code. When the user is not registered in Jira he send me an error

 

 


class Atlassian: JIRA_FIT = 'https://atlassian.net' jira_api_issue = '/rest/api/2/issue/'
def __init__(self, usuario, token): try: self.jira = Jira( url=self.JIRA_, username= usuario, password= token ) except: print("An exception occurred")

1 answer

1 accepted

1 vote
Answer accepted
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 1, 2020

Hello @Watson Vieira da Rocha ,

Welcome to the Atlassian Community!

I am not sure I understand what you mean with "validate the user in Jira". Can you kindly provide more details on what you are trying to achieve?

In case you are actually asking how to authenticate REST API calls in Python using basic auth (with Atlassian account email address and API token), then you can find an example in below thread:

If you are trying to do anything else, please let me know.

 

Cheers,
Dario

Watson Vieira da Rocha December 2, 2020

Hello @Dario B  How are you ?

I need to do something like, if the user enters their wrong password or their wrong login that returns an error like "Wrong or unregistered password or login"

 

Thanks very much !

Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 2, 2020

Hi @Watson Vieira da Rocha ,

 

I don't have enough context to be able to help you and I am not even sure what you are trying to achieve can actually be done since REST API calls are not authorized using the same credentials the users enter when they log-into Jira Cloud.

The different ways to authorize REST API calls are listed below:

 


However, if you are looking for advise on how to develop your app then I might not be the best person to help. I'd advise to try the resources listed in https://developer.atlassian.com/resources instead.

Specifically:

 

 

I hope this helps.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events