Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to authenticate with API token generated in the project ?

PMSupport October 23, 2024

 

How to authenticate with API token generated in the project ?

I am getting an error of Authentication whenever I am trying to run the scriptrunner script for Post action. Please guide on this. I am trying to create project with Issue key and have script written for the same. I have additionally tried with Automation rules as well, but there also with Send Web request its asking me for Authentication and nowhere I could find authentication window where I can put my org email and API token too.

1 answer

0 votes
Javier Martínez Caballero
Contributor
October 23, 2024

To authenticate with an API token in your scriptrunner script or automation rule, you’ll need to use Basic Authentication. Here's how you can do it:

  1. Basic Authentication:

    • In your script or automation, you won’t see an authentication window, but you can provide the API token as part of the request headers.
    • The format should be:
    Authorization: Basic base64encode(email:API_token)
    • Use base64 encoding for your email address and the API token together. For example, if your email is user@example.com and your API token is abc123, it would look like this:
    base64encode(user@example.com:abc123)

    The result is what you'll include in the Authorization header.

  2. For ScriptRunner: When making the request in ScriptRunner, make sure your request includes the encoded Authorization header with the basic auth format.

  3. For Automation Rules (Send Web Request): You’ll need to add the encoded Authorization header in the “Headers” section when configuring the “Send Web Request” action.

Let me know if you need further clarification! 😊

Suggest an answer

Log in or Sign up to answer