How to Check HipChat Server API Token Expiration

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Purpose

The admin of HipChat Server needs to pull information for specific or all API tokens from the instance to monitor them, in this case the expiry of the API token.

Solution

  • Access the terminal / SSH of the HipChat Server instance.
  • Run the following command on the terminal to obtain the expiry date and time for a specific token:

    DBPASS=$(awk '/"pass"/ {gsub(/[",]/,"");print $2}' /hipchat/config/site.json) && mysql -uroot -p$DBPASS hipchat -e "SELECT access_token_expires FROM oauth_sessions WHERE access_token='<access_token>';"
    admin@hipchat:~$ DBPASS=$(awk '/"pass"/ {gsub(/[",]/,"");print $2}' /hipchat/config/site.json) && mysql -uroot -p$DBPASS hipchat -e "SELECT access_token_expires FROM oauth_sessions WHERE access_token='SNfCq2wui7Xe7utOKuADwXLDDu8eMFgQq7zCIFId';"
    +----------------------+
    | access_token_expires |
    +----------------------+
    | 2019-01-19 06:58:03  |
    +----------------------+
  • If you would like to obtain the complete set of expiry date for the all the tokens, run the following command instead:

    DBPASS=$(awk '/"pass"/ {gsub(/[",]/,"");print $2}' /hipchat/config/site.json) && mysql -uroot -p$DBPASS hipchat -e "SELECT access_token_expires FROM oauth_sessions;"
    admin@hipchat:~$ DBPASS=$(awk '/"pass"/ {gsub(/[",]/,"");print $2}' /hipchat/config/site.json) && mysql -uroot -p$DBPASS hipchat -e "SELECT access_token_expires FROM oauth_sessions;"
    +----------------------+
    | access_token_expires |
    +----------------------+
    | 2019-01-19 06:58:03 |
    | 2019-12-23 23:04:41 |
    | 2019-12-23 23:04:48 |
    | 2019-12-23 23:04:56 |
    | 2019-12-23 23:05:02 |
    +----------------------+
Last modified on Dec 24, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.