Comment 0 for bug 1611342

Revision history for this message
Victor Tapia (vtapia) wrote :

In the preferences page, pressing 'Generate MAAS key' shows the error message "Unable to create a new token" and leaves the spinning "loading" wheel. Refreshing the page shows the new key in the list.

It looks like an exception ('unknown token c') triggers while parsing the keys from a malformed JSON in function "requestKeys" (maas-yui.js).

- JSON sample:

{consumer_key: zN2WyCmRYyCYk9r4Px, token_key: jR26eZFYrA7dHugv7f, token_secret: pbaPaERJXn3KAGfvkZdatQufvKvJ9xtJ}

- Code:

652 success: function(id, out) {
653 var keys;
654 try {
655 keys = JSON.parse(out.response);
656 }
657 catch(e) {
658 // Parsing error.
659 self.displayError('Unable to create a new token.');
660 }
661 // Generate a token from the keys.
662 var token = self.createTokenFromKeys(
663 keys.consumer_key, keys.token_key,
664 keys.token_secret);