Comments (4)
@ldw129 , please share the full code.. code above is for login request , not for transport estimate
from gojek.
or maybe the service type is not exists in those area
from gojek.
Hi @mychaelgo , thank you for your reply! For better clarity, below is the full edited code from:
- goid.js
const { TokenApi } = require('../../../sdk/goid-gojek-node/dist');
const tokenAPI = new TokenApi();
const defaultHeaders = {
xAppid: 'com.gojek.app',
xAppversion: '4.59.1',
xDeviceos: 'Android,10',
xPhonemake: 'Samsung',
xPhonemodel: 'GT-S7500',
xPlatform: 'Android',
xPushtokentype: 'FCM',
xUniqueid: '95f99ddd6a5d34a9',
xUserType: 'customer'
};
const testLoginRequest = async () => {
const loginResponse = await tokenAPI.loginRequest({
...defaultHeaders,
loginRequestBody:{
client_id: 'gojek:consumer:app',
client_secret: 'pGwQ7oi8bKqqwvid09UrjqpkMEHklb',
country_code: '+65',
login_type: 'otp_whatsapp',
magic_link_ref: '',
phone_number: '81464126'
}
});
console.log({ loginResponse: loginResponse.data });
};
const testGenerateToken = async () => {
const generateTokenResponse = await tokenAPI.generateToken({
...defaultHeaders,
generateTokenRequest: {
client_id: 'gojek:consumer:app',
client_secret: 'pGwQ7oi8bKqqwvid09UrjqpkMEHklb',
data: {
otp: '2960',
otp_token: 'd477d703-a5d3-43bb-92ce-7423929b0036'
},
grant_type: 'otp',
scopes: []
}
});
console.log({ generateTokenResponse: generateTokenResponse.data });
};
// testLoginRequest();
testGenerateToken();
- get-transport-estimate.js
const { TransportApi, Configuration } = require('../../../sdk/api-gojek-node');
const configuration = new Configuration({
accessToken: 'eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJhdWQiOlsiZ29qZWs6Y29uc3VtZXI6YXBwIl0sImRhdCI6eyJhY3RpdmUiOiJ0cnVlIiwiYmxhY2tsaXN0ZWQiOiJmYWxzZSIsImNvdW50cnlfY29kZSI6Iis2NSIsImNyZWF0ZWRfYXQiOiIyMDIwLTA3LTEyVDA0OjUxOjM3WiIsImVtYWlsIjoibGltZG9uZ3dhbjIwMTUyOEBnbWFpbC5jb20iLCJlbWFpbF92ZXJpZmllZCI6InRydWUiLCJnb3BheV9hY2NvdW50X2lkIjoiMDEtYzNmOTZkNTk5Zjc2NDEzZThkZDUyZTcxMjA0ZGNiNmMtMjQiLCJuYW1lIjoiTGltIERvbmcgV2FuIiwibnVtYmVyIjoiODE0NjQxMjYiLCJwaG9uZSI6Iis2NTgxNDY0MTI2Iiwic2lnbmVkX3VwX2NvdW50cnkiOiJJRCIsIndhbGxldF9pZCI6IjIwMTk0MDI5MTQzMDk1ODEyNyJ9LCJleHAiOjE2ODIwNzIzNjQsImlhdCI6MTY3OTIzMzUyMywiaXNzIjoiZ29pZCIsImp0aSI6ImI2OWJhZWVhLTg5MGItNGY1OS05YzZiLWI2YTUwZWU3YWMwYiIsInNjb3BlcyI6W10sInNpZCI6IjJhMjNlZjdiLTIyMGMtNGJkMy04ZGU2LWQwNzM2MmM3YTVjMyIsInN1YiI6ImQ0NTkyZDg4LTBkMDctNDhkYS1hNWUzLTc2NmEyZGNhNWYwZiIsInVpZCI6IjY4NTA1NjQ3NiIsInV0eXBlIjoiY3VzdG9tZXIifQ.OwQZeIjD_l11YuSEQ6Sdm6aqitdl6ny8tvCmilHacuhRsCMpWRvVq-1BWaWg2lyfT0WBtZfe43GuFQcyh-7V1Qmjr16DRhn6bMvqaRXY6gAPYe24C_vXoCIzT9Ieb8DiJkSv9sdxEE8pEHRPs9Mpk3uT6tK5UvetTxrvrFKseq0'
});
// const configuration = new Configuration({
// accessToken: process.env.GOJEK_ACCESS_TOKEN
// });
const transportAPI = new TransportApi(configuration);
const defaultHeaders = {
xAppid: 'com.gojek.app',
xAppversion: '4.59.1',
xDeviceos: 'Android,10',
xPhonemake: 'Samsung',
xPhonemodel: 'GT-S7500',
xPlatform: 'Android',
xPushtokentype: 'FCM',
xUniqueid: '95f99ddd6a5d34a9',
xUserType: 'customer',
xSessionId: 'd31cc210-a067-4d0d-a52f-199880ea8907',
gojekCountryCode: 'ID'
};
const getTransportEstimate = async () => {
const getTransportEstimateResponse = await transportAPI.getTransportEstimate({
...defaultHeaders,
sendPrioritisedOrder: true,
userSelectedServiceType: 1,
waypoints: '1.3376415,103.6947157|1.3336745,103.6758544'
});
console.log(JSON.stringify(getTransportEstimateResponse.data));
};
getTransportEstimate();
Just to clarify, I first ran goid.js to get the OTP from Gojek and generate the access token, then I ran get-transport-estimate.js using the access token generated. This was where the error, as mentioned in my first comment above, surfaced.
Thank you!
from gojek.
i wanna ask i get 400 error, im using waypoint in singapore
from gojek.
Related Issues (15)
- [ASK] Order Gojek Feature HOT 3
- Not getting token after calling login API HOT 3
- [ASK] How did you get the endpoint list? HOT 1
- Mau tanya apakah masih bisa dipakai wrapper API ini? HOT 2
- Publish new code to NPM HOT 1
- Order Go-Send Feature? HOT 2
- Ask mendapatkan semua API HOT 2
- Snif HOT 3
- Generate Customer Token HOT 4
- Gojek fare API HOT 1
- mfa:customer_send_challenge:challenge_required HOT 13
- GoID Generate Access Token HOT 2
- Error 400 to get estimate price in singapore HOT 1
- [ASK] possible authentication error: getTransportEstimate
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gojek.