ianjwhite99 / connected-car-node-sdk Goto Github PK
View Code? Open in Web Editor NEWOpen-source JavaScript SDK for Ford vehicles connected via FordPass and SYNC.
License: MIT License
Open-source JavaScript SDK for Ford vehicles connected via FordPass and SYNC.
License: MIT License
Add recall status functionality, similar to the python-sdk
Originally posted by plamish January 5, 2022
Hey @ianjwhite99, great and neat work. Thanks for the SDK.
Here is URL for checking active recalls you may consider adding as new functionality:
https://api.mps.ford.com/api/recall/v1/recalls?vin=&language=DE®ion=CH&country=CHE
Cheers
Looks like Ford has disabled the OAuth password grant based on the error response CSIAQ0172E The grant type [password] is not supported. Supported grant types are [authorization_code, refresh_token]
.
Looking into a solution!
I’d like to deploy this in AWS Lambda. I have some experience deploying small NodeJS functions, but have never deployed a python function. I imagine this might be a popular deployment option, so from a feature request perspective it would be great if the documentation included a “how to” get it running up there. I’m going to give it a whirl myself, but any time saving tips would be greatly appreciated.
When trying to get an access token, I get an error message in fetchAuthorizationCode
:
fordapp://userauthorized?error_description=CSIAQ0159E+You+are+not+authorized+to+access+this+protected+resource.&error=access_denied
All calls before that are going just fine so I think it's really the fetchAuthorizationCode
that's not working out properly.
The GET is done with a proper-looking URL I got from Ford:
https://sso.ci.ford.com/oidc/endpoint/default/authorize?qsId=d9aa5f49-92a3-40e1-8edc-BLAAT&client_id=9fb503e0-715b-47e8-adfd-ad4b7770f73b&identity_source_id=BLAAT
I would assume that if something went wrong in the process before that, Ford would throw an error earlier.
Anyone got a clue if this is again Ford messing up? Their latest app update also crashes after logging in 'fresh'...
Not a bug, but a development question. I've re-implemented this api for evcc-io/evcc#4477 and fail to update to the latest changes from #35. Could I kindly ask you for advise what's wrong with this request? I can't seem to find any difference with this repo, yet always end in HTTP 404.
POST /api/expdashboard/v1/details HTTP/1.1
Host: api.mps.ford.com
User-Agent: FordPass/5 CFNetwork/1333.0.4 Darwin/21.5.0
Content-Length: 51
Accept: application/json
Application-Id: 1E8C7794-FF5F-49BC-9596-A1E0C86C5B19
Auth-Token: eyJ0...
Content-Type: application/json
Countrycode: EUR
Accept-Encoding: gzip
{"dashboardRefreshRequest":"All","smsWakeUpVIN":""}
Much appreciated, thank you!
Ford changed the FordPass authentication endpoint. The Ford authorization endpoint will now only generate proper access tokens using the OAuth 2.0 Authorization Code Grant.
I'm getting the following error when trying to login
ConnectedCarException: status 400 reading FigAuthTokenvalidationApi#validateToken(DashBoardServiceIdentityToken,String,String); response : feign.Response$InputStreamBody@a129a9e
at D:\Node JS\Mazda\node_modules\connected-car\dist\Api\Api.js:75:23
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
SyncErrorStatus: 500,
SyncErrorMessage: 'status 400 reading FigAuthTokenvalidationApi#validateToken(DashBoardServiceIdentityToken,String,String); response : feign.Response$InputStreamBody@a129a9e'
}
Here is the code i used
login = async (username, password) => {
token = await client.getAccessTokenFromCredentials({
username,
password
});
user = ConnectedCar.User(token);
let vehicles = await user.vehicles();
for (userVehicle of vehicles) {
const Vehicle = {
id: userVehicle.VIN,
};
vehicleList.push(Vehicle)
}
}
When trying to get an access token, I get an error message in fetchAuthorizationCode
:
fordapp://userauthorized?error_description=CSIAQ0159E+You+are+not+authorized+to+access+this+protected+resource.&error=access_denied
All calls before that are going just fine so I think it's really the fetchAuthorizationCode
that's not working out properly.
The GET is done with a proper-looking URL I got from Ford:
https://sso.ci.ford.com/oidc/endpoint/default/authorize?qsId=d9aa5f49-92a3-40e1-8edc-BLAAT&client_id=9fb503e0-715b-47e8-adfd-ad4b7770f73b&identity_source_id=BLAAT
I would assume that if something went wrong in the process before that, Ford would throw an error earlier.
Anyone got a clue if this is again Ford messing up? Their latest app update also crashes after logging in 'fresh'...
I'm getting the following error when trying to authenticate and get a fresh token:
"404 v1 is deprecated."
When calling status on a vehicle, a 403/forbidden response is being returned from Ford.
A simple example:
import connectedcar from 'connected-car';
const client = connectedcar.AuthClient('9fb503e0-715b-47e8-adfd-ad4b7770f73b');
const token = await client.getAccessTokenFromCredentials({
username: '*****',
password: '****',
});
const refreshToken = await client.getAccessTokenFromRefreshToken(token.getRefreshToken());
const user = connectedcar.User(token.getValue());
const vehicles = await user.vehicles();
const vehicleList = []; // Array of vehicles
for (let userVehicle of vehicles) // For each user vehicle
vehicleList.push(userVehicle['VIN']);
let currentVehicle = connectedcar.Vehicle(vehicleList[0], token.getValue());
console.log(currentVehicle);
const status = await currentVehicle.status();
console.log(status);
When executing user.getVehicles you get a statuscode 400 (bad request)
To Reproduce Steps to reproduce the behavior:
i've created this function:
async function getVehicles(user) {
const vehicles = await user.vehicles();
const vehicleList = [];
for (userVehicle of vehicles)
vehicleList.push(userVehicle['VIN']);
return vehicleList;
}
Sadly it returns a 400 on await user.vehicles();
Note: Token- and user- calls work perfectly fine. We get a token and a User with success.
I'd expect to get a list of vehicles
Desktop (please complete the following information):
Hi all,
It seems Ford has started cracking down on third party services taking advantage of their apis.
Recently I was locked out of my account and after speaking to Ford support they told me it was because of an unauthorized third party service using my credentials, which would be connected-car SDK's.
I am curious if anyone else has experienced this issue?
Is your feature request related to a problem? Please describe. A clear and concise description
of what the problem is. Ex. I'm always frustrated when [...]
I would like to request for a proxy feature.
Describe the solution you'd like A clear and concise description of what you want to happen.
Currently it works locally but when I run the program in digitalocean, it gets blocked.
Describe alternatives you've considered A clear and concise description of any alternative
solutions or features you've considered.
I had previously made it work in php using proxy, but recently they changed their auth flow. So I can't just always keep on changing
things. So i am using this package but it lacks proxy feature.
Additional context Add any other context or screenshots about the feature request here.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.