Commit feee3ec6 authored by Alexei's avatar Alexei

Verify credentials after first-time setup

Credentials were previously verified only when the main process sent the
existing access tokens to the renderer process. Now, credentials will be
verified even when you just finished authorizing the client.
parent 580168f5
......@@ -59,14 +59,18 @@ ipcRenderer.on('needs-auth', function(event, data) {
ipcRenderer.on('token', function(event, data) {
access_token = data;
oauth.get('https://quitter.no/api/account/verify_credentials.json', access_token.public, access_token.secret, verify_credentials);
verify_credentials();
});
var authorizeWindow = null;
function verify_credentials(a, b, c) {
if (c.statusCode == 200 && c.statusMessage == 'OK')
credentials_verified = true;
function verify_credentials() {
oauth.get('https://quitter.no/api/account/verify_credentials.json', access_token.public, access_token.secret, function(a, b, c) {
if (c.statusCode == 200 && c.statusMessage == 'OK') {
credentials_verified = true;
console.log("Credentials were verified");
}
});
}
function handleRequestToken(err, token, token_secret, parsedQueryString) {
......@@ -100,8 +104,9 @@ function handleAccessToken(err, token, token_secret, parsedString) {
if (err === null) {
access_token.public = token;
access_token.secret = token_secret;
ipcRenderer.send('save-token', access_token);
verify_credentials();
}
ipcRenderer.send('save-token', access_token);
}
function changeTab(tab) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment