Skip to content
This repository has been archived by the owner on Aug 25, 2022. It is now read-only.

Refresh Tokens

Dustin Bryant edited this page May 31, 2020 · 1 revision

Ring now requires users to turn on Two-Factor Authentication (2fa) for additional security. Go to your http://Ring.com account and set up Two-Factor Authentication. For automation purposes, we need a special refreshToken from Ring. To get a refreshToken, we're going to use the ring-client-api (https://github.com/dgreif/ring). Perform the following in a terminal window to get your refresh token (this is assuming you have already run npm install on the MMM-Ring module):

  1. Navigate to this folder: MagicMirror/modules/MMM-Ring/
  2. Run the following command and follow all the prompts npx -p ring-client-api ring-auth-cli

After entering your information, you will see a refreshToken in the output. Copy the token and open up the MagicMirror config.js file. Add ring2faRefreshToken config option and set its value to the token from the command above. Restart MagicMirror and Ring should authenticate successfully.

Example config:

		{
			module: "MMM-Ring",
			position: "middle_center",
			config: {
				ring2faRefreshToken: "TOKEN FROM COMMAND ABOVE"
			}
		},

Note: Your refreshToken is just as valuable as an email/password so treat it with the same care you would a password.

This information was adapted for use with the MMM-Ring module from the underlining ring-client-api (https://github.com/dgreif/ring) wiki entry for Refresh Tokens (see https://github.com/dgreif/ring/wiki/Refresh-Tokens).

Refresh Token Expiration

Ring has updated their refresh tokens so that they expire within a couple minutes of when they are used for the first time. This means that you basically only get to use a refresh token once, and need to keep the new refresh token that comes with the response.

The good news is, this module will automatically get a new updated refresh token for you when the other expires. The only caveat being you need to supply at least the first token through the above process into the config ring2faRefreshToken.

If you run into an issue or see errors related to the token, delete the .env file within the MMM-Ring folder and get a new refreshToken with the above methods and place that refreshToken into the ring2faRefreshToken within the MagicMirror config.

Clone this wiki locally