Skip to content

Instantly share code, notes, and snippets.

@MadLittleMods
Last active March 5, 2018 23:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MadLittleMods/01158db1056da3b86495 to your computer and use it in GitHub Desktop.
Save MadLittleMods/01158db1056da3b86495 to your computer and use it in GitHub Desktop.

Gitter Desktop App authentication

If you feel uncomfortable signing into GitHub in the node-webkit frame, these instructions will go over a manual way to authorize and set your token.

Note: This guide assumes Gitter is already an authorized app for your GitHub account. To do this, just make sure you can sign in with the web client in your browser.

Get your personal token

Use the login link in the top right of the developer.gitter.im.

Once logged in, you should be redirected to a page with your token and "Your Apps". You can also access this page in the top right via the "Apps" navigation item.

We are just concerned with the token.

For example, the fake example token we will use is: 123f45678ak11a2e3ff04a55fk670e7fake9

Note: Do not share your token. It is tied to your account and anyone with this token can perform actions on behalf of your account.

Open the desktop app Dev tools

Open a new Gitter desktop instance through the terminal CLI/CMD prompt with the --remote-debugging-port flag option. You can find the path to the Gitter.exe via your shortcut. On Windows, my path looked like this:

C:\Users\madli_000\AppData\Local\Programs\Gitter\Gitter.exe --remote-debugging-port=1234
open /Applications/Gitter.app --args --remote-debugging-port=1234

Visit http://localhost:1234/ in your browser and you should see "Inspectable WebContents" with some entries.

Choose the "Gitter" one, not the login window.

Set the desktop App token

Go to the console and enter the following snippet; remember to replace the settings.token line appropriately with your Gitter personal token we got in a previous step.

var Store = require('jfs');

var db = new Store(gui.App.dataPath + '/gitter_preferences.json', { pretty: true });
// initial load is done synchronously
var settings = db.getSync('settings');

settings.token = '123f45678ak11a2e3ff04a55fk670e7fake9';

db.save('settings', settings, function (err) {
	if (err) {
		console.error('ERROR: Could not save settings.');
		return events.emit('settings:failed', err);
	}
	console.log('Settings saved succcessfully');
	events.emit('settings:saved');
});

Exit and Start the app again

Exit the app. Then start it back up and you should be signed in and be able to chat :)

@apfelfabrik
Copy link

On OS X, the executable appears to be /Applications/Gitter.app/Contents/MacOS/Gitter, yet running

$ /Applications/Gitter.app/Contents/MacOS/Gitter --remote-debugging-port=1234

yields ERR_CONNECTION_REFUSED in Chrome when accessing localhost:1234.

@sbromberger
Copy link

Just a heads-up: it doesn't look like require is valid client-side javascript. I haven't found a browser yet that allows it.

@IvanBelis
Copy link

IvanBelis commented Feb 8, 2018

Having the same problem with the require javascript in the snippet. As an alternative you can edit the %localappdata%/gitter/gitter_preferences.json and add the token there:
"token" : "017....."

@Lupus590
Copy link

Lupus590 commented Mar 5, 2018

@IvanBelis Thankyou! This worked a treat when the OP didn't.

@MadLittleMods Perhaps it's time to change the instructions, they don't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment