smartcar/node-sdk

Fail hard if invalid make is passed

Closed this issue · 1 comments

Currently if someone passes an unknown or misspelled make, we just return undefined/oauth/authorize?response_type=code&.... as the auth url. We should instead throw an error if the make is incorrect as the correct behavior leads to silent errors.

node-sdk/lib/auth-client.js

Lines 100 to 106 in 2d364ee

}
const query = qs.stringify(parameters);
return `${config.oems[make]}/oauth/authorize?${query}`;
};

We should also probably have an enum of sorts for the makes.

So instead of client.getAuthUrl('mock'); -> client.getAuthUrl(smartcar.MAKES.MOCK)