You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Mychael and friends, after generating my gojek access token via the login and generate scripts, I have attempted calling the getTransportEstimate function. The following is my code:
import { TransportApi, Configuration } from '@mychaelgo/api-gojek';
// import 'react-native-url-polyfill/auto.js';
import GOJEK_ACCESS_TOKEN from '../../auth/token.js'; (where i stored the token)
// import getPickupGojek from './getPickupGojek';
// import getDropoffGojek from './getDropoffGojek';
const token = GOJEK_ACCESS_TOKEN;
const configuration = new Configuration({
accessToken: token
});
const transportAPI = new TransportApi(configuration);
Hi Mychael and friends, after generating my gojek access token via the login and generate scripts, I have attempted calling the getTransportEstimate function. The following is my code:
import { TransportApi, Configuration } from '@mychaelgo/api-gojek';
// import 'react-native-url-polyfill/auto.js';
import GOJEK_ACCESS_TOKEN from '../../auth/token.js'; (where i stored the token)
// import getPickupGojek from './getPickupGojek';
// import getDropoffGojek from './getDropoffGojek';
const token = GOJEK_ACCESS_TOKEN;
const configuration = new Configuration({
accessToken: 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: 'SG'
};
const FetchGojek = async () => {
};
FetchGojek();
It seems that although my access_token is accurate, I am still not authenticated. Any ideas on what is wrong? The error that I have gotten is this:
Error: Request failed with status code 422
at createError (/Users/aldensio/Desktop/Gobber/Gobber-app/node_modules/@mychaelgo/api-gojek/node_modules/axios/lib/core/createError.js:16:15)
at settle (/Users/aldensio/Desktop/Gobber/Gobber-app/node_modules/@mychaelgo/api-gojek/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/Users/aldensio/Desktop/Gobber/Gobber-app/node_modules/@mychaelgo/api-gojek/node_modules/axios/lib/adapters/http.js:269:11)
at IncomingMessage.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1359:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
config: {
url: 'https://api.gojekapi.com/transport/v1/estimate?send_prioritised_order=true&user_selected_service_type=1&waypoints=1.294260%2C103.774320%7C1.3336745%2C103.6758544',
method: 'get',
headers: {
Accept: 'application/json, text/plain, /',
Authorization: 'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJhdWQiOlsiZ29qZWs6Y29uc3VtZXI6YXBwIl0sImRhdCI6eyJhY3RpdmUiOiJ0cnVlIiwiYmxhY2tsaXN0ZWQiOiJmYWxzZSIsImNvdW50cnlfY29kZSI6Iis2NSIsImNyZWF0ZWRfYXQiOiIyMDE5LTAxLTEyVDExOjEyOjA3WiIsImVtYWlsIjoiYWxkZW5zaW9AbGl2ZS5jb20iLCJlbWFpbF92ZXJpZmllZCI6InRydWUiLCJnb3BheV9hY2NvdW50X2lkIjoiMDEtMzJiYzgxMDY0YzZiNDdjMThiZDQ2YWY0NmUxYTA5MzEtMjkiLCJuYW1lIjoiYWxkZW4gc2lvIHNpYW5nIHlpbiIsIm51bWJlciI6Ijk3ODgwMDE3IiwicGhvbmUiOiIrNjU5Nzg4MDAxNyIsInNpZ25lZF91cF9jb3VudHJ5IjoiU0ciLCJ3YWxsZXRfaWQiOiIxOTAxMjA2NzIxNDU5NTc3MjUifSwiZXhwIjoxNjg5NDkzODg4LCJpYXQiOjE2ODY4NTI3NjAsImlzcyI6ImdvaWQiLCJqdGkiOiJjMGVkNDg0My1hZjMyLTQ5ZjktOGU2OC1kMmJjNzliMWMxYjkiLCJzY29wZXMiOltdLCJzaWQiOiJiOGU2MzYwYS0wNzZjLTQ5ZTEtYmM0YS0xMjgzNGI5ZGEwZmUiLCJzdWIiOiIxMzdmOTJkNy00MGM0LTQ2ZGMtOTIzYi0xYmM2MDQ3NDIwYmQiLCJ1aWQiOiI2MTg5OTA0MDYiLCJ1dHlwZSI6ImN1c3RvbWVyIn0.UVlVGNuvK-GEyHhfuHMTXNXWt7s0T5PFRCWdWGYAvFLIjfarSlDJFYyXWs-a5_K4k4U4NhNbDwhzMNWZbvsdUOV6d9Ge82-ajSpSf7l74HTnelbvcwRcWboTvuWBvI2qNoWuH0T8eGgHHodFOr2zz6pIxxTqZb10CapcMdeGnYI',
'x-platform': 'Android',
'gojek-country-code': 'SG',
'x-uniqueid': '95f99ddd6a5d34a9',
'x-appversion': '4.59.1',
'x-appid': 'com.gojek.app',
'x-deviceos': 'Android,10',
'x-user-type': 'customer',
'x-phonemake': 'Samsung',
'x-phonemodel': 'GT-S7500',
'x-pushtokentype': 'FCM',
'x-session-id': 'd31cc210-a067-4d0d-a52f-199880ea8907',
'User-Agent': 'axios/0.21.4'
},
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
adapter: [Function: httpAdapter],
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
data: undefined
},
request: <ref *2> ClientRequest {
_events: [Object: null prototype] {
abort: [Function (anonymous)],
aborted: [Function (anonymous)],
connect: [Function (anonymous)],
error: [Function (anonymous)],
socket: [Function (anonymous)],
timeout: [Function (anonymous)],
finish: [Function: requestOnFinish]
},
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
strictContentLength: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
_closed: false,
socket: <ref *1> TLSSocket {
_tlsOptions: {
allowHalfOpen: undefined,
pipe: false,
secureContext: SecureContext { context: SecureContext {} },
isServer: false,
requestCert: true,
rejectUnauthorized: true,
session: undefined,
ALPNProtocols: undefined,
requestOCSP: undefined,
enableTrace: undefined,
pskCallback: undefined,
highWaterMark: undefined,
onread: undefined,
signal: undefined
},
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: false,
_SNICallback: null,
servername: 'api.gojekapi.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype] {
close: [
[Function: onSocketCloseDestroySSL],
[Function: bound onceWrapper] {
listener: [Function (anonymous)]
},
[Function: onClose],
[Function: socketCloseListener]
],
end: [Function: onReadableStreamEnd],
newListener: [Function: keylogNewListener],
secure: [Function: onConnectSecure],
session: [Function (anonymous)],
free: [Function: onFree],
timeout: [Function: onTimeout],
agentRemove: [Function: onRemove],
error: [Function: socketErrorListener],
finish: [Function: bound onceWrapper] { listener: [Function: destroy] }
},
_eventsCount: 10,
connecting: false,
_hadError: false,
_parent: null,
_host: 'api.gojekapi.com',
_closeAfterHandlingError: false,
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: true,
ended: false,
endEmitted: false,
reading: true,
constructed: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: false,
autoDestroy: true,
destroyed: false,
errored: null,
closed: false,
closeEmitted: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
dataEmitted: true,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
_maxListeners: undefined,
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: true,
needDrain: false,
ending: true,
ended: true,
finished: false,
destroyed: false,
decodeStrings: false,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 1,
constructed: true,
prefinished: false,
errorEmitted: false,
emitClose: false,
autoDestroy: true,
errored: null,
closed: false,
closeEmitted: false,
[Symbol(kOnFinished)]: []
},
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: TLSWrap {
_parent: TCP {
reading: [Getter/Setter],
onconnection: null,
[Symbol(owner_symbol)]: [Circular *1]
},
_parentWrap: undefined,
_secureContext: SecureContext { context: SecureContext {} },
reading: true,
onkeylog: [Function: onkeylog],
onhandshakestart: {},
onhandshakedone: [Function (anonymous)],
onocspresponse: [F
The text was updated successfully, but these errors were encountered: