KunalKatariya opened a new issue, #8704:
URL: https://github.com/apache/incubator-devlake/issues/8704

   ### 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
   
   My organization uses Jira Server + Okta SAML. 
   I added my PAT and Jira DC endpoint but got below error, so even though I 
saw `Test connection successfully`, this was the stack trace I saw in Network's 
tab:
   ```
   {
     "code": 0,
     "success": false,
     "message": "attached stack trace\n  -- stack trace:\n  | 
github.com/apache/incubator-devlake/helpers/pluginhelper/api.UnmarshalResponse\n
  | \t/app/helpers/pluginhelper/api/api_client.go:437\n  | [...repeated from 
below...]\nWraps: (2) error decoding response from 
https://<JIRA_HOST>/jira/plugins/servlet/samlsso/loggedin: raw response: \n  
|\n  |\n  |\n  |\n  |\n  |\n  | <!DOCTYPE html>\n  | <html lang=\"en\" \n  |\n  
|\n  |\n  |\n  |\n  |\n  |  data-theme=\"dark:dark light:light\" 
data-color-mode=\"dark\" >\n  | <head>\n  |     \n  |\n  |\n  |\n  |\n  |\n  
|\n  |\n  |\n  |\n  | <meta charset=\"utf-8\">\n  | <meta 
http-equiv=\"X-UA-Compatible\" content=\"IE=Edge\"/>\n  | <title>You are 
already logged in - Jira</title>\n  | <meta name=\"application-name\" 
content=\"JIRA\" data-name=\"jira\" data-version=\"10.3.12\"><meta 
name=\"ajs-server-scheme\" content=\"https\"><meta name=\"ajs-server-port\" 
content=\"443\">\n  | <meta name=\"ajs-server-name\" content=\"<JIRA_HOST>\">\n 
 | <m
 eta name=\"ajs-base-url\" content=\"https://<JIRA_HOST>/jira\">\n  | <meta 
name=\"ajs-context-path\" content=\"/jira\">\n  | <meta 
name=\"ajs-version-number\" content=\"10.3.12\">\n  | <meta 
name=\"ajs-build-number\" content=\"10030012\">\n  | <meta 
name=\"ajs-remote-user\" content=\"<USER_EMAIL>\">\n  | <meta 
name=\"ajs-remote-user-fullname\" content=\"<USER_FULLNAME>\">\n  | <meta 
name=\"ajs-user-locale\" content=\"en_US\">\n  | ...\n  | <meta 
id=\"atlassian-token\" name=\"atlassian-token\" content=\"<XSRF_TOKEN>\">\n  | 
...\n  | <img 
src=\"https://<JIRA_HOST>/jira/secure/useravatar?size=small&avatarId=<AVATAR_ID>\"
 alt=\"User profile for <USER_FULLNAME>\"/>\n  | ...\n  | <a 
href=\"/jira/browse/<PROJECT_KEY>\" class=\"aui-nav-link ...\">Projects</a>\n  
| ...\n  | <strong>You are already logged in.</strong>\n  | ...\n  | <input 
type=\"hidden\" title=\"baseURL\" value=\"https://<JIRA_HOST>/jira\" />\n  | 
...\n  | <!--\n  |                  REQUEST ID : <REQUEST_ID>\n  |           RE
 QUEST TIMESTAMP : [<TIMESTAMP>]\n  |                REQUEST TIME : 
<REQUEST_TIME>\n  |                  ASESSIONID : <ASESSIONID>\n  |         
CONCURRENT REQUESTS : <N>\n  | -- >\n  |\n  | </body>\n  | </html>\n  |  
(200)\nWraps: (3) attached stack trace\n  -- stack trace:\n  | 
github.com/apache/incubator-devlake/helpers/pluginhelper/api.UnmarshalResponse\n
  | \t/app/helpers/pluginhelper/api/api_client.go:431\n  | 
github.com/apache/incubator-devlake/plugins/jira/api.queryJiraAgileBoards\n  | 
\t/app/plugins/jira/api/remote_api.go:64\n  | 
github.com/apache/incubator-devlake/plugins/jira/api.listJiraRemoteScopes\n  | 
\t/app/plugins/jira/api/remote_api.go:100\n  | 
github.com/apache/incubator-devlake/helpers/pluginhelper/api.(*DsRemoteApiScopeListHelper[...]).Get\n
  | \t/app/helpers/pluginhelper/api/ds_remote_api_scope_list_helper.go:78\n  | 
github.com/apache/incubator-devlake/plugins/jira/api.RemoteScopes\n  | 
\t/app/plugins/jira/api/remote_api.go:116\n  | github.com/apache/incubator-de
 vlake/server/api.handlePluginCall.func1\n  | \t/app/server/api/router.go:141\n 
 | github.com/gin-gonic/gin.(*Context).Next\n  | 
\t/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174\n  | 
github.com/apache/incubator-devlake/server/api.OAuth2ProxyAuthentication.func1\n
  | \t/app/server/api/middlewares.go:95\n  | 
github.com/apache/incubator-devlake/server/api.RestAuthentication.func1\n  | 
\t/app/server/api/middlewares.go:117\n  | net/http.serverHandler.ServeHTTP\n  | 
\t/usr/local/go/src/net/http/server.go:2936\n  | net/http.(*conn).serve\n  | 
\t/usr/local/go/src/net/http/server.go:1995\n  | runtime.goexit\n  | 
\t/usr/local/go/src/runtime/asm_arm64.s:1172\nWraps: (4) invalid character '<' 
looking for beginning of value\nWraps: (5) invalid character '<' looking for 
beginning of value\nError types: (1) *withstack.withStack (2) 
*errutil.withPrefix (3) *withstack.withStack (4) *errutil.withPrefix (5) 
*json.SyntaxError",
     "causes": [
       "invalid character '<' looking for beginning of value"
     ],
     "data": null
   }
   
   ```
   
   It seems Jira fails to authenticate and redirects to our SSO probably.
   
   ### What do you expect to happen
   
   I expected the connection to pass, reason being that my below curl command 
worked and provided me my details and the board list with the PAT that I used 
for testing:
   
   ```
   curl -i \
     -H "Authorization: Bearer ${JIRA_PAT}" \
     -H "Accept: application/json" \
     "https://<jira-host>/jira/rest/api/2/myself"
   
   ```
   
   ```
   curl -i -H "Authorization: Bearer ${JIRA_PAT}" \
     "https://<jira-host>/jira/rest/agile/1.0/board?maxResults=1"
   ```
   
   ### How to reproduce
   
   Pre-requisite:
   Require Jira Server instance with SSO SAML.
   
   1. Create new Data Connection: Jira
   2. Select `Jira Server`
   3. Add PAT and endpoint URL
   4. Click "Test Connection" and check network logs
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   v1.0.3-beta9@1410838
   
   ### Are you willing to submit PR?
   
   - [ ] 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to