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

How best to determine the server url from capabilities payload? #180

Open
burlesona opened this issue Oct 21, 2016 · 1 comment
Open

How best to determine the server url from capabilities payload? #180

burlesona opened this issue Oct 21, 2016 · 1 comment

Comments

@burlesona
Copy link

If you're authenticating hipchat over oauth, you can get the server API url from the capabilities.json. However, this already includes the version number in it. The HipChat ruby gem seems to want the server URL without the version string in it for HipChat Server connections.

At first I thought you could just use the "subdomain" field in the capabilities descriptor to get around this, but it's not consistent with HipChat Cloud, eg:

https://api.hipchat.com/v2/capabilities

links: {
  api: "https://api.hipchat.com/v2",
  homepage: "https://www.hipchat.com",
  self: "https://api.hipchat.com/v2/capabilities",
  subdomain: "https://www.hipchat.com"
}

https://marketplace.lightning.hcsinf.com/v2/capabilities

links: {
  api: "https://marketplace.lightning.hcsinf.com/v2",
  homepage: "https://marketplace.lightning.hcsinf.com",
  self: "https://marketplace.lightning.hcsinf.com/v2/capabilities",
  subdomain: "https://marketplace.lightning.hcsinf.com"
},

So the only thing I can think of is to take the API url given and chop the last three characters off, but that seems like quite the hack.

Any recommendation on a better way to extract the proper server url for users authenticating with Oauth?

@rberrelleza
Copy link
Contributor

mmm..actually I think using the subdomain is not a bad idea, it works for both deployments( try https://www.hipchat.com/v2/room and https://marketplace.lightning.hcsinf.com/v2/room with the corresponding tokens).

Or even the 'homepage' attribute would work as the base URL for all the APIs, I think.

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

2 participants