Skip to content

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

@burlesona

Description

@burlesona

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions