Skip to content

Commit

Permalink
fix(auth): OAuth Client Fix (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian authored Jun 21, 2022
1 parent fe626b0 commit cc18095
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Api/Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class Api {
'auth-token': accessToken,
Accept: '*/*',
'Accept-Language': 'en-US',
'User-Agent': 'FordPass/5 CFNetwork/1327.0.4 Darwin/21.2.0',
'User-Agent': 'FordPass/5 CFNetwork/1333.0.4 Darwin/21.5.0',
'Content-Type': 'application/json',
'Accept-Encoding': 'gzip, deflate, br',
'Application-Id': regions[region],
Expand Down
10 changes: 5 additions & 5 deletions src/Authentication/OAuth2Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class OAuth2Client {
public async getAccessTokenFromRefreshToken(refreshToken: string): Promise<AccessToken> {
return await axios
.put(
'https://api.mps.ford.com/api/oauth2/v1/refresh',
'https://api.mps.ford.com/api/token/v2/cat-with-refresh-token',
{
refresh_token: refreshToken,
},
Expand Down Expand Up @@ -101,7 +101,7 @@ export class OAuth2Client {
Accept: '*/*',
'Accept-Language': 'en-US',
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'FordPass/5 CFNetwork/1327.0.4 Darwin/21.2.0',
'User-Agent': 'FordPass/5 CFNetwork/1333.0.4 Darwin/21.5.0',
'Accept-Encoding': 'gzip, deflate, br',
},
}
Expand All @@ -110,16 +110,16 @@ export class OAuth2Client {
if (res.status === 200 && res.data.access_token) {
return await axios
.put(
'https://api.mps.ford.com/api/oauth2/v1/token',
'https://api.mps.ford.com/api/token/v2/cat-with-ci-access-token',
{
code: res.data.access_token,
ciToken: res.data.access_token,
},
{
headers: {
Accept: '*/*',
'Accept-Language': 'en-US',
'Content-Type': 'application/json',
'User-Agent': 'FordPass/5 CFNetwork/1327.0.4 Darwin/21.2.0',
'User-Agent': 'FordPass/5 CFNetwork/1333.0.4 Darwin/21.5.0',
'Accept-Encoding': 'gzip, deflate, br',
'Application-Id': this.region,
},
Expand Down
6 changes: 3 additions & 3 deletions src/Vehicle/Vehicle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class Vehicle extends Api {
*/
public async status(): Promise<AxiosResponse['data']> {
return this.get(
`https://usapi.cv.ford.com/api/vehicles/v4/${this.vehicleVIN}/status?lrdt=01-01-1970%2000:00:00`
`https://usapi.cv.ford.com/api/vehicles/v5/${this.vehicleVIN}/status`
);
}

Expand Down Expand Up @@ -243,7 +243,7 @@ export class Vehicle extends Api {
): Promise<AxiosResponse['data']> {
if (method === 'PUT') {
return await this.put(
`https://usapi.cv.ford.com/api/vehicles/v2/${this.vehicleVIN}/${context}`
`https://usapi.cv.ford.com/api/vehicles/v5/${this.vehicleVIN}/${context}`
)
.then(async res => {
if (res.commandId) return await this.checkVehicleStatus(context, res.commandId);
Expand All @@ -254,7 +254,7 @@ export class Vehicle extends Api {
});
} else if (method === 'DELETE') {
return await this.delete(
`https://usapi.cv.ford.com/api/vehicles/v2/${this.vehicleVIN}/${context}`
`https://usapi.cv.ford.com/api/vehicles/v5/${this.vehicleVIN}/${context}`
)
.then(async res => {
if (res.commandId) return await this.checkVehicleStatus(context, res.commandId);
Expand Down

0 comments on commit cc18095

Please sign in to comment.