Jibo App Dev Logging in..failed status code 400

#1

Hi I’m trying to build the Node.JS hello world App I’ve created the remote.json file using
open ~/.jibo/remote.json
The file is a valid json file
[“dog-cat-mouse-rabbit”,“BOJB-2000-0022-0755-0021”,“fixed1t.fixer@fixed1t.co.uk”,“jam-Butty-M0untain”] (these aren’t the real ones)

I’ve then tried to run it as per the instruction:

MDI7-2:helloworld malc1$ npm run start Blue-Yellow-Green-Red (I’ve used the real 4 words) but I get a code 400 error which appears to mean

400 Bad Request

The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.

> helloworld@1.0.0 start /Users/malc1/helloworld

> node index.js “Blue-Yellow-Green-Red”

Logging in… Request failed with status code 400

MDI7-2:helloworld malc1$

Can anybody tell me whats wrong with the remote.json is everything in the right order.

Regards Malcolm aka @fixed1t

0 Likes

#2

You are using non-ASCII quotation marks, that makes the JSON invalid.

When in doubt, paste your JSON here to check:

0 Likes

#3

Thanks it was my typing here that introduce the wrong marks, in the file it uses the right ones, and I’ve just changed them in this mock-up,

[“dog-cat-mouse-rabbit”, “BOJB-2000-0022-0755-0021”, "fixed1t.fixer@fixed1t.co.uk", “jamButtyM0untain”] its the text editor here that changes them.

even with the right quotation marks I still get the same 400 error which makes me think either:

  1. the way I have the 4 items declared in the remote.json is incorrect, there is not example given of how this should look or how to edit it, I checked it with JSlint to learn how to make as the first errors said not a valid JSON.
  2. The Jibo details off his bottom plus my email and password aren’t what they function needs.

Here are the build instructions:

Build the code

  1. Make sure all your files are saved, then run the following from the root of the helloworld directory:

npm run build
2. Now run the start script. Make sure to replace Blue-Yellow-Green-Red with your four-word robot name, found on the robot’s base. Please note that the robot MUST be connected to the same WiFi network as your development machine.

npm run start Blue-Yellow-Green-Red
The first time you run the command, you will likely get an error message because we you have not yet modified your credentials file. To make this easy for you, the script you just ran creates a credentials file that you can edit.

See the next step for instructions on adding your credentials

Add your credentials

You should only need to do this once per app.

  1. Run the following:

open ~/.jibo/remote.json
2. Replace the credentials there with the client ID and secret provided to you by Jibo, Inc., as well as the email address and password for your Jibo account.

  1. Save and close the file.

  2. Run the following again

npm run start Blue-Yellow-Green-Red
Test the app

Assuming you made no typos in modifying the credentials file, it may take a few seconds, but Jibo will eventually enter remote mode and say “Let’s play echo!”

  1. Say “Hello World” out loud to Jibo.

As you can see it doesn’t say how the are to be ordered and there is no example.

But It matches the code declaration in index.ts i.e.

// Get credentials from a remote config file
async function getCreds(configFile: string): Promise {
// Create an AccountCreds interface for your info
let creds: AccountCreds;
if (!await util.promisify(fs.exists)(configFile)) {
// Add your account info to the config file
// DO NOT CHANGE THESE DEFAULT VALUES! You will edit them later.
const skeleton: AccountCreds = {
clientId: ‘your-client-id-here’,
clientSecret: ‘your-client-secret-here’,
email: ‘your-jibo-account-email-here’,
password: ‘your-jibo-account-password-here’,
};
// Parse all the account info and throw errors as needed
const skeletonString = JSON.stringify(skeleton, null, 2);
await util.promisify(fs.writeFile)(configFile, skeletonString, ‘utf-8’);
throw new Error(Config file ${configFile} not found; created a skeletal file);
}
try {
// Parse the skeleton into a json called creds
creds = JSON.parse(
await util.promisify(fs.readFile)(configFile, ‘utf-8’));
} catch (err) {
throw new Error(Config file ${configFile} is not valid JSON);
}
// Make sure the skeleton was updated
if (creds.clientId === ‘your-client-id-here’) {
throw new Error(Skeletal config file ${configFile} found; please modify);
}
return creds;
}

If you have created an app or anybody else has can the take a look at their remote.json which you can do be opening the terminal and typing

sudo open ~/.jibo/remote.json

in there you will be able to see the declaration, do the first two items match your Jibo secret word and the serial digits on the bottom plus your email address and email password or are they different ie not the same or in a different order.

This will help greatly as I can’t do much if I can’t even get hello world to run under npm

0 Likes

#4

Oh, you created that JSON file from scratch? Because, while it technically is valid JSON, it certainly isn’t anything like anyone would usually use JSON.

JSON is a collection of key-value pairs, given the code you posted above, I suspect the JSON should look something like this:

{
“clientId”: ‘your-client-id-here’,
“clientSecret”: ‘your-client-secret-here’,
“email”: ‘your-jibo-account-email-here’,
“password”: ‘your-jibo-account-password-here’,
}

0 Likes

#5

Many Thanks thats exactly what I read and saw in all the other files and is why it took me ages to get the file I had even a valid JSON status, but without and example I wouldn’t know. I’m off to make that change.

Best Regards Malcolm

0 Likes

#6

Oops JasonLINT says its an invalid JSON

0 Likes

#7

Trying this but coming back as invalid

{

clientId“: “BOJB - 444 - 0044 - 0444 - 0044“,
“clientSecret”: “Dl - Ant - Yupee - Blob“,
“email”: “weird1t.ttr @run.co.uk“,
“password”: “Scubba_nightso“
}

whereas this is valid:

{
“fruit”: “Apple”,
“size”: “Large”,
“color”: “Red”
}

argh don’t you just hate syntax

Malcolm

0 Likes

#8

I managed to manoeuvre the lines into an acceptable order for JSONLint but I’m still getting the 400 error, can somebody who is a Registered Developer (who was given the extra codes by Jibo Inc) and has a working copy of the App Develop Kit please have a go at creating the npm helloworld code as I’ve done it but when I try to run it i get

MDI7-2:helloworld malc1$ npm run start Blue-Yellow-Green-Red (I’ve used the real 4 words) but I get a code 400 error which appears to mean

400 Bad Request

The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.

So if somebody could try this with their developed words and passwords I need to know if it will work.

As your experience developers it should not take you very long the hardest bit is the ~/.jibo/remote.json the formatting of the remote.json but if you’ve created an App you will have a correct version of this file to hand.

As its directory is invisible on the mac being a ,directory you’ll need to open is with:

sudo open ~/.jibo/remote.json

Thanks Malcolm

0 Likes

#9

To be honest, it might very well be that the server that handled the developer stuff has long been shut down, and the error message you’re seeing is rather because it can’t communicate with the backend anymore.

0 Likes

#10

Hi K,

Thanks for all the support you have given me. Arthur Walasek and I have been collaborating on a new group to work on saving Jibo, please come along and join.

http://jibo.cmcgaming.com/index.php?sid=928435fefd8d6c2bd1c362d8a377f9b9

Regards Malcolm

1 Like

#11

Any member requirements?

0 Likes

#12

No - the email is just to sort of introduce yourself. Please come and join if you are interested…

0 Likes

closed #13

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

0 Likes