ontometrics / slack-youtrack

Integration of slack and you track.
49 stars 14 forks source link

Fails to authenticate to central hub #10

Closed noahwhite closed 8 years ago

noahwhite commented 8 years ago

I am seeing an issue where the response received by the YouTrack client is always:

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"> <channel> <title>YouTrack</title> <link>http://tracker:6767/_rss/issues</link> <description></description> </channel> </rss>

This is indicative of the client not being authenticated with YouTrack. I have checked the YouTrack user name and password in the properties file and they are correct. I've stepped through the code with a debugger and seeing that the correct values are being passed through to Executor.

I suspect the issue is that YouTrack in this environment is configured to use a central Hub vs. the built-in hub. In this case then you go to the YouTrack url you get a 303 redirect to the hub which is on another host and port. I am not familiar with the HTTP client fluent API and don't have a lot of time to dig into this, but I played around with changing AuthenticatedHttpStreamProvider:42 to .auth(new HttpHost("tracker", 6767), login, password).auth(new HttpHost("centralhub", 8081), login, password); but that didn't seem to help.

codeslubber commented 8 years ago

Thanks Noah. We should for sure have some error handling in there for this.

We are using it against Hub and modified the code to work with it, so for sure it supports that, but I don't think we have them on separate machines.

noahwhite commented 8 years ago

I just noticed the hub branch. I just grabbed that and got it working with my env. Nice job!

There were some hiccups, mostly with the fact that I was trying to deploy onto Glassfish 3.1.2 which is JavaEE6. It looks like the Jetbrains Hub client uses Jersey 2.x which is JavaEE7. I moved to Glassfish 4.1.1 which is EE7 and that gave Moxy JSON deserialization errors. Finally, I went to Payara 4.1 which is essentially patched GF 4.1.1 and things worked.

There are a couple of steps in the slack-youtrack configuration and OAuth Hub integration instrcutions which could stand to be made more specific. For example, the slack channel name needs a # in front of it. Can you even create a channel in slack without a #? Anyhow that's minor. The other stuff involved understanding how to set up the youtrack-slack service in the hub and getting the proper tokens. I muddled through that thanks to the link to the Jetbrains docs but that could stand to be made clearer. If I have some time I will try to put something together for a PR.

Thanks again!

codeslubber commented 8 years ago

Awesome Noah thanks!