Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't connect to Jira user Account #985

Open
supergeoff opened this issue Oct 13, 2023 · 10 comments
Open

Can't connect to Jira user Account #985

supergeoff opened this issue Oct 13, 2023 · 10 comments

Comments

@supergeoff
Copy link

supergeoff commented Oct 13, 2023

Hello
Followed documentation, bot needs to connect Jira user Account, popup does open but Jira response with an error :
could not get user info for client, err: No response returned: Get "https://crit-digital.atlassian.net/rest/api/2/myself": oauth2: cannot fetch token: 400 Bad Request Response: {"error":"invalid_grant","error_description":"Invalid aud: https://auth.atlassian.io"}

Similar to #945

Regards ;

@mickmister
Copy link
Member

Hi @supergeoff, thanks for reporting this issue. I have a few questions:

  • What version of the Jira plugin are you using?
  • How long has your MM server been integrated with Jira? How many users are connected? (just for me to have some context)
  • Are you using the cloud instance type for the Jira Cloud connection? If so, we recommend using the newer cloud-oauth instance type, which can be installed with /jira instance install cloud-oauth (Jira URL). This solves the in your description. This is available in v4.0.0 of the plugin.

@elrancid
Copy link

elrancid commented Oct 17, 2023

Hi @mickmister, I had the same problem (reported here: https://community.atlassian.com/t5/Jira-Software-questions/Error-connecting-to-Jira-with-Mattermost-plugin/qaq-p/2501718). I updated to version 4 and installed with cloud-oauth (after I've removed old app in jira management app).
I followed the bot's instructions for setting permissions on jira, but the "Configure" button to press in mattermost jira's bot doesn't woks and it's not possible to enter the jira details (client ID and secret) to continue.
The console say:
POST https://mattermost.<my_domain>/api/v4/posts/uo5iiqq56tfiu8goi4uyfgci4e/actions/gd3erkqptjfsur35hf4f87ohic 400 (Bad Request)
Thanks for your suppport

@mickmister
Copy link
Member

Hi @elrancid, Just so I understand correctly, you are using /jira setup or /jira instance install cloud-oauth (url)? Then you get to the step with the "Configure" button, but clicking the button doesn't open a modal?

I'm thinking starting over on the setup process may fix something happening here. Are there any relevant log messages in your server logs?

@elrancid
Copy link

elrancid commented Oct 17, 2023

No, I did't do /jira setup, it isn't documented. I've done only /jira instance install cloud-oauth (url). If I do /jira setup bot say:

Just a few more configuration steps to go!
1. Choose your Jira edition.
2. Create an incoming application link.
3. Configure a Jira subscription webhook.
4. Connect your user account.

There's no documentation on how to achieve those tasks, because the documentation link https://mattermost.gitbook.io/plugin-confluence/plugin-jira/setting-up/configuration doesn't works.
For the Jira edition: how to set it?
The incoming application link should be done with /jira instance install cloud (url) process? bot say it's deprecated.
Clicking on "Continue" button log say:

{"timestamp":"2023-10-17 12:53:36.209 Z","level":"debug","msg":"Action integration error.","caller":"web/context.go:114","path":"/api/v4/posts/3wtdgiunnpdu3yyt1qokq61e5c/actions/11pk4djrrtbn5e31kbgo3zafwr","request_id":"t8715xcmsbf73ctnsw55wuc4ur","ip_addr":"127.0.0.1","user_id":"moepmz8jbinu7pbfo8te4shqbc","method":"POST","err_where":"DoActionRequest","http_code":400,"error":"DoActionRequest: Action integration error., err=Post \"https://mattermost.joule.video/plugins/jira/setup-wizard/button\": tls: failed to verify certificate: x509: certificate has expired or is not yet valid: current time 2023-10-17T12:53:36Z is after 2023-10-15T10:07:06Z"}
{"timestamp":"2023-10-17 12:53:36.209 Z","level":"debug","msg":"Received HTTP request","caller":"web/handlers.go:173","method":"POST","url":"/api/v4/posts/3wtdgiunnpdu3yyt1qokq61e5c/actions/11pk4djrrtbn5e31kbgo3zafwr","request_id":"t8715xcmsbf73ctnsw55wuc4ur","user_id":"moepmz8jbinu7pbfo8te4shqbc","status_code":"400"}

@mickmister
Copy link
Member

err=Post \"https://mattermost.joule.video/plugins/jira/setup-wizard/button\": tls: failed to verify certificate: x509: certificate has expired or is not yet valid: current time 2023-10-17T12:53:36Z is after 2023-10-15T10:07:06Z"

@elrancid It seems the SSL certificate being used for your Mattermost server may be invalid. The above error implies that the certificate is expired: current time 2023-10-17T12:53:36Z is after 2023-10-15T10:07:06Z. Is it possible the certificate needs to be updated?

@elrancid
Copy link

elrancid commented Oct 17, 2023

If you mean the domain certificate, no, the certificate expire in 2024. Could it be a certificate with Jira Cloud?

@mickmister
Copy link
Member

@elrancid It's reporting this for the service that will receive a request at https://mattermost.joule.video/plugins/jira/setup-wizard/button, which would be your Mattermost server.

The underlying issue here is that the server isn't handing this request off to the plugin directly, and is instead performing an actual HTTP request to itself, to be processed by the plugin. I was under the impression we were handing it off directly in the case of interactive messages, and we are doing so based on the code below, but there may be an issue there:

https://github.com/mattermost/mattermost/blob/e1db660f70388a02acbd2e1d988d6ac9476294e1/server/channels/app/integration_action.go#L318-L321

Either way, the immediate solution for you will be something with your server's certificate. I'm not sure exactly what the solution is though.

@mickmister
Copy link
Member

@hanzei Any ideas why we would see the above error when we are indeed using a.DoLocalRequest for this kind of request? In the code linked above, I think we may need to change

rawURLPath := path.Clean(rawURL)

to

rawURLPath := path.Clean(inURL.Path)

@mickmister
Copy link
Member

This discussion is out of scope of this ticket though. I've created a separate issue for this here https://mattermost.atlassian.net/browse/MM-54994

@mickmister
Copy link
Member

mickmister commented Nov 20, 2023

Hi @supergeoff, we've released a version of the Jira plugin that fixes this issue v4.0.0 about 2 months ago. Have you had the chance to try this version of the plugin?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants