You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@devlake.apache.org by "kamiyariko (via GitHub)" <gi...@apache.org> on 2024/07/08 08:07:32 UTC
[I] [Bug][Jira][REST API] Unable to set up Jira connection via API due to token length issue [incubator-devlake]
kamiyariko opened a new issue, #7702:
URL: https://github.com/apache/incubator-devlake/issues/7702
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and found no similar issues.
### What happened
I want to configure Jira Cloud connection settings using the REST API.
However, when executing the following command, I encounter an error indicating that the token length is too long:
curl -X 'POST' \
'https://devlake.xxxxx/api/plugins/jira/connections' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"authMethod": "BasicAuth",
"endpoint": "https://xxxxx.atlassian.net/rest/",
"name": "jira-test-connection",
"password": "{jira-password}",
"proxy": "",
"rateLimitPerHour": 0,
"token": "{jira-token}",
"username": "{jira-username}"
}'
The error message received is:
`{
"code": 0,
"success": false,
"message": "Error 1406 (22001): Data too long for column 'token' at row 1 (500)\nWraps: (2) Error 1406 (22001): Data too long for column 'token' at row 1\nError types: (1) *hintdetail.withDetail (2) *mysql.MySQLError",
"causes": null,
"data": null
}
`
Jira personal access tokens are 192 characters long, but attempting to use a token of 169 characters or more results in this error.
Does Devlake support tokens of this length?
### What do you expect to happen
I expect to be able to configure the Jira connection successfully by including the token in the request.
### How to reproduce
After executing the command provided earlier to set up the Jira Cloud connection,
I attempted to test the connection using the following command:
curl -X 'POST' \
'https://devlake.xxxxx/api/plugins/jira/connections/{connectionId}/test' \
-H 'accept: application/json' \
-H 'Content-Type: application/json'
### Anything else
https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/
Following the documentation, using the token name as the username allows the request to go through, but results in a "Please check your credential (401)" error:
curl -X 'POST' \
'https://devlake.xxxxx/api/plugins/jira/connections' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"authMethod": "BasicAuth",
"endpoint": "https://xxxxx.atlassian.net/rest/",
"name": "jira-test-connection",
"password": "{jira-password}",
"proxy": "",
"rateLimitPerHour": 0,
"token": "{jira-token}",
"username": "{jira-username}"
}' \
-u '{jira-username}:{token-label}'
Jira's official documentation also assumes that applications will support token lengths:
https://community.atlassian.com/t5/Jira-Service-Management/How-to-generate-a-token-with-less-than-128-characters/qaq-p/2373530
### Version
v.1.0.0-beta10
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@devlake.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug][Jira][REST API] Unable to set up Jira connection via API due to token length issue [incubator-devlake]
Posted by "kamiyariko (via GitHub)" <gi...@apache.org>.
kamiyariko commented on issue #7702:
URL: https://github.com/apache/incubator-devlake/issues/7702#issuecomment-2213392573
Yes, The type of the `token` field in the `_tool_jira_connections` table is `varchar(255)`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug][Jira][REST API] Unable to set up Jira connection via API due to token length issue [incubator-devlake]
Posted by "d4x1 (via GitHub)" <gi...@apache.org>.
d4x1 commented on issue #7702:
URL: https://github.com/apache/incubator-devlake/issues/7702#issuecomment-2213322422
@kamiyariko Can you check `token` field in table `_tool_jira_connections`? It's length should be VARCHAT(255).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug][Jira][REST API] Unable to set up Jira connection via API due to token length issue [incubator-devlake]
Posted by "kamiyariko (via GitHub)" <gi...@apache.org>.
kamiyariko commented on issue #7702:
URL: https://github.com/apache/incubator-devlake/issues/7702#issuecomment-2215892447
That was a success! Thank you for your support.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug][Jira][REST API] Unable to set up Jira connection via API due to token length issue [incubator-devlake]
Posted by "d4x1 (via GitHub)" <gi...@apache.org>.
d4x1 commented on issue #7702:
URL: https://github.com/apache/incubator-devlake/issues/7702#issuecomment-2213490996
@kamiyariko `varchar(255)` is enough for PAT with length 192, and I have tried to set an illegal token with length 193, it can be saved successfully.

Compared with your curl command, I think the root cause is `token` is in payload["password"] not payload["token"]. You can have a try.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug][Jira][REST API] Unable to set up Jira connection via API due to token length issue [incubator-devlake]
Posted by "kamiyariko (via GitHub)" <gi...@apache.org>.
kamiyariko closed issue #7702: [Bug][Jira][REST API] Unable to set up Jira connection via API due to token length issue
URL: https://github.com/apache/incubator-devlake/issues/7702
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org