Not Authorized - No Token on Capacitor.js
jongbonga opened this issue · 1 comments
jongbonga commented
My implemention works well on web but as soon as I build a mobile app with capacitor, I get a 401 Not Authorized - No Token
import Optimization, { OptimizationService } from '@mapbox/mapbox-sdk/services/optimization';
const mbxClient = Optimization({ accessToken: environment.mapbox.accessToken });
mbxClient
.getOptimization({
profile: 'driving-traffic',
source: 'first',
destination: 'last',
overview: 'full',
waypoints,
roundtrip: false
})
.send();
same for Geocoding
const mbxClient = Geocoding({ accessToken: environment.mapbox.accessToken });
mbxClient
.forwardGeocode({
query: '',
proximity: 'ip',
mode: 'mapbox.places',
types: ['address', 'poi']
})
.send()