@transistorsoft/background-geolocation-types 5.0.0-beta.3 → 5.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/api/BackgroundGeolocation.d.ts +3 -1551
- package/dist/core/api/CurrentPositionRequest.d.ts +0 -36
- package/dist/core/api/DeviceSettings.d.ts +0 -63
- package/dist/core/api/Logger.d.ts +0 -400
- package/dist/core/api/State.d.ts +0 -63
- package/dist/core/api/TransistorAuthorizationService.d.ts +0 -110
- package/dist/core/config/ActivityConfig.d.ts +0 -260
- package/dist/core/config/AppConfig.d.ts +0 -581
- package/dist/core/config/AuthorizationConfig.d.ts +0 -191
- package/dist/core/config/Config.d.ts +1 -177
- package/dist/core/config/GeoConfig.d.ts +0 -876
- package/dist/core/config/HttpConfig.d.ts +0 -565
- package/dist/core/config/LocationFilter.d.ts +0 -256
- package/dist/core/config/LoggerConfig.d.ts +0 -313
- package/dist/core/config/NotificationConfig.d.ts +0 -504
- package/dist/core/config/PersistenceConfig.d.ts +0 -541
- package/dist/core/data/DeviceInfo.d.ts +0 -54
- package/dist/core/data/Geofence.d.ts +0 -5
- package/dist/core/data/Location.d.ts +0 -213
- package/dist/core/data/Sensors.d.ts +0 -22
- package/dist/core/events/AuthorizationEvent.d.ts +0 -9
- package/dist/core/events/ConnectivityChangeEvent.d.ts +0 -6
- package/dist/core/events/GeofenceEvent.d.ts +0 -10
- package/dist/core/events/GeofencesChangeEvent.d.ts +0 -7
- package/dist/core/events/HeadlessEvent.d.ts +0 -7
- package/dist/core/events/HeartbeatEvent.d.ts +0 -10
- package/dist/core/events/HttpEvent.d.ts +0 -8
- package/dist/core/events/MotionActivityEvent.d.ts +0 -7
- package/dist/core/events/MotionChangeEvent.d.ts +0 -7
- package/dist/core/events/ProviderChangeEvent.d.ts +0 -10
- package/dist/core/events/Subscription.d.ts +0 -83
- package/dist/docs-entry.js +0 -3
- package/dist/enums/AccuracyAuthorization.d.ts +0 -16
- package/dist/enums/AccuracyAuthorization.js +0 -12
- package/dist/enums/ActivityType.d.ts +0 -25
- package/dist/enums/ActivityType.js +0 -21
- package/dist/enums/AuthorizationStatus.d.ts +0 -16
- package/dist/enums/AuthorizationStatus.js +0 -13
- package/dist/enums/AuthorizationStrategy.d.ts +0 -9
- package/dist/enums/AuthorizationStrategy.js +0 -6
- package/dist/enums/DesiredAccuracy.d.ts +0 -6
- package/dist/enums/DesiredAccuracy.js +0 -5
- package/dist/enums/Event.d.ts +0 -9
- package/dist/enums/Event.js +0 -5
- package/dist/enums/GeofenceAction.d.ts +0 -17
- package/dist/enums/GeofenceAction.js +0 -13
- package/dist/enums/HttpMethod.d.ts +0 -7
- package/dist/enums/HttpMethod.js +0 -6
- package/dist/enums/KalmanProfile.d.ts +0 -26
- package/dist/enums/KalmanProfile.js +0 -25
- package/dist/enums/LocationError.d.ts +0 -19
- package/dist/enums/LocationError.js +0 -15
- package/dist/enums/LocationFilterPolicy.d.ts +0 -104
- package/dist/enums/LocationFilterPolicy.js +0 -103
- package/dist/enums/LocationRequest.d.ts +0 -19
- package/dist/enums/LocationRequest.js +0 -15
- package/dist/enums/LogLevel.d.ts +0 -20
- package/dist/enums/LogLevel.js +0 -16
- package/dist/enums/LogLevelName.d.ts +0 -6
- package/dist/enums/LogLevelName.js +0 -5
- package/dist/enums/MotionActivityType.d.ts +0 -6
- package/dist/enums/MotionActivityType.js +0 -5
- package/dist/enums/NotificationPriority.d.ts +0 -16
- package/dist/enums/NotificationPriority.js +0 -15
- package/dist/enums/PersistMode.d.ts +0 -7
- package/dist/enums/PersistMode.js +0 -6
- package/dist/enums/SQLQueryOrder.d.ts +0 -11
- package/dist/enums/SQLQueryOrder.js +0 -10
- package/dist/enums/TrackingMode.d.ts +0 -11
- package/dist/enums/TrackingMode.js +0 -10
- package/dist/enums/TriggerActivity.d.ts +0 -7
- package/dist/enums/TriggerActivity.js +0 -6
- package/dist/index.js +0 -4
- package/dist/legacy/LegacyConfig.d.ts +0 -19
- package/package.json +1 -1
|
@@ -1,200 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configure the SDK to authenticate with your server using an
|
|
3
|
-
* {@link AuthorizationConfig.accessToken | access token} (e.g., a
|
|
4
|
-
* [JSON Web Token](https://jwt.io/)), and automatically request new tokens when
|
|
5
|
-
* the server returns **`401 Unauthorized`**.
|
|
6
|
-
*
|
|
7
|
-
* **Note:** Only [JSON Web Token](https://jwt.io/) (JWT) is currently supported.
|
|
8
|
-
*
|
|
9
|
-
* The SDK automatically attaches your token to each HTTP request:
|
|
10
|
-
*
|
|
11
|
-
* ```txt
|
|
12
|
-
* Authorization: Bearer XXX.YYY.ZZZ
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
* When using {@link Config.authorization}, **do not** manually define
|
|
16
|
-
* `Authorization` inside {@link HttpConfig.headers}. The SDK manages all JWT
|
|
17
|
-
* headers automatically.
|
|
18
|
-
*
|
|
19
|
-
* If you supply {@link AuthorizationConfig.refreshUrl},
|
|
20
|
-
* {@link AuthorizationConfig.refreshToken}, and
|
|
21
|
-
* {@link AuthorizationConfig.refreshPayload}, the SDK can automatically refresh
|
|
22
|
-
* expired tokens when a `401 Unauthorized` response is received.
|
|
23
|
-
*
|
|
24
|
-
* **Configuration**
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
* const token = getMyToken(); // Your own JWT fetch method
|
|
29
|
-
*
|
|
30
|
-
* // Listen for authorization refresh results
|
|
31
|
-
* BackgroundGeolocation.onAuthorization((event) => {
|
|
32
|
-
* if (event.success) {
|
|
33
|
-
* console.log("[authorization] SUCCESS:", event.response);
|
|
34
|
-
* } else {
|
|
35
|
-
* console.log("[authorization] ERROR:", event.error);
|
|
36
|
-
* }
|
|
37
|
-
* });
|
|
38
|
-
*
|
|
39
|
-
* // Initialize with JWT authorization
|
|
40
|
-
* BackgroundGeolocation.ready({
|
|
41
|
-
* http: {
|
|
42
|
-
* url: "https://app.your.server.com/users/locations",
|
|
43
|
-
* autoSync: true,
|
|
44
|
-
* },
|
|
45
|
-
* authorization: {
|
|
46
|
-
* strategy: "JWT",
|
|
47
|
-
* accessToken: token.accessToken,
|
|
48
|
-
* refreshToken: token.refreshToken,
|
|
49
|
-
* refreshUrl: "https://auth.your.server.com/tokens",
|
|
50
|
-
* refreshPayload: {
|
|
51
|
-
* the_refresh_token_field_name: "{refreshToken}"
|
|
52
|
-
* },
|
|
53
|
-
* expires: token.expiresAt,
|
|
54
|
-
* }
|
|
55
|
-
* });
|
|
56
|
-
* ```
|
|
57
|
-
*
|
|
58
|
-
* **Receiving responses from** {@link AuthorizationConfig.refreshUrl}
|
|
59
|
-
*
|
|
60
|
-
* Whenever the SDK receives a response from your
|
|
61
|
-
* {@link refreshUrl}, it fires
|
|
62
|
-
* {@link BackgroundGeolocation.onAuthorization}. Your callback will receive an
|
|
63
|
-
* {@link AuthorizationEvent}.
|
|
64
|
-
*
|
|
65
|
-
* - On **success**, {@link AuthorizationEvent.response} contains the parsed JSON.
|
|
66
|
-
* - On **error**, {@link AuthorizationEvent.error} contains the error message.
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```ts
|
|
70
|
-
* BackgroundGeolocation.onAuthorization((event) => {
|
|
71
|
-
* if (event.success) {
|
|
72
|
-
* console.log("[authorization] SUCCESS:", event.response);
|
|
73
|
-
* } else {
|
|
74
|
-
* console.log("[authorization] ERROR:", event.error);
|
|
75
|
-
* }
|
|
76
|
-
* });
|
|
77
|
-
* ```
|
|
78
|
-
* @category Config
|
|
79
|
-
*/
|
|
80
1
|
export interface AuthorizationConfig {
|
|
81
|
-
/**
|
|
82
|
-
* Authorization strategy. Only [JWT](https://jwt.io/) is supported.
|
|
83
|
-
*/
|
|
84
2
|
strategy: string;
|
|
85
|
-
/**
|
|
86
|
-
* Authorization token (eg: [JWT](https://jwt.io/)) required for authorization by your server at {@link HttpConfig.url}.
|
|
87
|
-
*
|
|
88
|
-
* The SDK will automatically apply the configured `accessToken` to each HTTP request's `Authorization` header, eg:
|
|
89
|
-
*
|
|
90
|
-
* `"Authorization": "Bearer XXX.YYY.ZZZ"`
|
|
91
|
-
*
|
|
92
|
-
* You do **not** need to manually configure {@link HttpConfig.headers} with the `Authorization` parameter. It is all **automatic**.
|
|
93
|
-
*/
|
|
94
3
|
accessToken: string;
|
|
95
|
-
/**
|
|
96
|
-
* The token to be POSTed to {@link refreshUrl}, encoded into the {@link refreshPayload}, when a new {@link accessToken} is required after {@link expires} or when HTTP `401 Unauthorized` is received.
|
|
97
|
-
*/
|
|
98
4
|
refreshToken?: string;
|
|
99
|
-
/**
|
|
100
|
-
* The url to your authorization server that provides new {@link accessToken} when expired.
|
|
101
|
-
*
|
|
102
|
-
* When the SDK receives a response the server, it will decode the JSON and recursively iterate through the keys, performing regular expressions and other String-analysis *to "taste"* the data in search of the following 3 items:
|
|
103
|
-
*
|
|
104
|
-
* 1. "access token"
|
|
105
|
-
* 2. "refresh token"
|
|
106
|
-
* 3. "expiry time"
|
|
107
|
-
*
|
|
108
|
-
* The SDK is designed to operate with *any* response data-structure. For example, one authorization server might return a complex response such as:
|
|
109
|
-
*
|
|
110
|
-
* ```json
|
|
111
|
-
* {
|
|
112
|
-
* "token": {
|
|
113
|
-
* "access_token": "XXX.YYY.ZZZ",
|
|
114
|
-
* "expires_at": 3900
|
|
115
|
-
* },
|
|
116
|
-
* "refresh_token": "smTsfaspfgaadsfgqZerUt0wueflasdfkaxjdfeKIacb"
|
|
117
|
-
* }
|
|
118
|
-
* ```
|
|
119
|
-
*
|
|
120
|
-
* While another server might return a flat response, such as:
|
|
121
|
-
*
|
|
122
|
-
* ```json
|
|
123
|
-
* {
|
|
124
|
-
* "accessToken": "XXX.YYY.ZZZ",
|
|
125
|
-
* "refreshToken": "smTsfaspfgaadsfgqZerUt0wueflasdfkaxjdfeKIacb",
|
|
126
|
-
* "expiry": 3900
|
|
127
|
-
* }
|
|
128
|
-
* ```
|
|
129
|
-
*
|
|
130
|
-
* When the response from the server is received, the event {@link BackgroundGeolocation.onAuthorization} will be fired, provided with the {@link AuthorizationEvent}.
|
|
131
|
-
*/
|
|
132
5
|
refreshUrl?: string;
|
|
133
|
-
/**
|
|
134
|
-
* Refresh payload will be encoded into the FORM POST to the {@link refreshUrl} when requesting a new {@link accessToken} after expiration.
|
|
135
|
-
*
|
|
136
|
-
* You *must* provide one field-template which will represent your "refresh token" using the value: __`{refreshToken}`__. The SDK will
|
|
137
|
-
* _automatically_ replace this simple template with the configured {@link refreshToken}.
|
|
138
|
-
*
|
|
139
|
-
* @example
|
|
140
|
-
*
|
|
141
|
-
* ```typescript
|
|
142
|
-
* BackgroundGeolocation.ready({
|
|
143
|
-
* authorization: {
|
|
144
|
-
* strategy: "JWT",
|
|
145
|
-
* accessToken: "XXX.YYY.ZZZ",
|
|
146
|
-
* refreshUrl: "https://auth.your.server.com/tokens",
|
|
147
|
-
* refreshToken: "smTsfaspfgaadsfgqZerUt0wueflasdfkaxjdfeKIacb",
|
|
148
|
-
* refreshPayload: {
|
|
149
|
-
* my_refresh_token: "{refreshToken}",
|
|
150
|
-
* grant_type: "refresh_token",
|
|
151
|
-
* foo: "another arbitrary field"
|
|
152
|
-
* }
|
|
153
|
-
* }
|
|
154
|
-
* });
|
|
155
|
-
* ```
|
|
156
|
-
*
|
|
157
|
-
* with the configuration above, a **`curl`** representation of the SDK's FORM POST, might look like this:
|
|
158
|
-
* ```bash
|
|
159
|
-
* $ curl -X POST \
|
|
160
|
-
* -F 'my_refresh_token=smTsfaspfgaadsfgqZerUt0wueflasdfkaxjdfeKIacb' \
|
|
161
|
-
* -F 'grant_type=refresh_token' \
|
|
162
|
-
* -F 'foo=another arbitrary field' \
|
|
163
|
-
* https://auth.your.server.com/tokens
|
|
164
|
-
* ```
|
|
165
|
-
*
|
|
166
|
-
*/
|
|
167
6
|
refreshPayload?: Record<string, string>;
|
|
168
|
-
/**
|
|
169
|
-
* Optional headers applied on requests to {@link refreshUrl}
|
|
170
|
-
* Defaults to: `{"Authorization": "Bearer {accessToken}"}`
|
|
171
|
-
*
|
|
172
|
-
* The template variable `{accessToken}` will automatically be replaced with your app's current auth token.
|
|
173
|
-
*
|
|
174
|
-
* If you do not want *any* headers applied on requests to {refreshUrl}, provide an empty `{}`.
|
|
175
|
-
*
|
|
176
|
-
* ## Example
|
|
177
|
-
*
|
|
178
|
-
* ```typescript
|
|
179
|
-
* BackgroundGeolocation.ready({
|
|
180
|
-
* authorization: {
|
|
181
|
-
* accessToken: "XXX.YYY.ZZZ",
|
|
182
|
-
* refreshUrl: "https://auth.domain.com/tokens",
|
|
183
|
-
* refreshToken: "smTsfaspfgaadsfgqZerUt0wueflasdfkaxjdfeKIacb",
|
|
184
|
-
* refreshPayload: {
|
|
185
|
-
* "my_refresh_token": "{refreshToken}", // <-- replaced with configured refreshToken above.
|
|
186
|
-
* "grant_type": "refresh_token", // <-- arbitrary fields required by your auth server
|
|
187
|
-
* "foo": "another arbitrary field"
|
|
188
|
-
* },
|
|
189
|
-
* refreshHeaders: {} // <-- Empty {} to provide no refreshHeaders.
|
|
190
|
-
* )
|
|
191
|
-
* ));
|
|
192
|
-
* ```
|
|
193
|
-
*
|
|
194
|
-
*/
|
|
195
7
|
refreshHeaders?: Record<string, string>;
|
|
196
|
-
/**
|
|
197
|
-
* Token expiry time in seconds.
|
|
198
|
-
*/
|
|
199
8
|
expires?: number;
|
|
200
9
|
}
|
|
@@ -6,190 +6,14 @@ import { PersistenceConfig } from './PersistenceConfig';
|
|
|
6
6
|
import { ActivityConfig } from './ActivityConfig';
|
|
7
7
|
import { AuthorizationConfig } from './AuthorizationConfig';
|
|
8
8
|
import { TransistorAuthorizationToken } from '../api/TransistorAuthorizationService';
|
|
9
|
-
/**
|
|
10
|
-
* Configuration API.
|
|
11
|
-
*
|
|
12
|
-
* The `Config` class defines all SDK options, grouped into compound
|
|
13
|
-
* configuration objects:
|
|
14
|
-
*
|
|
15
|
-
* - {@link GeoConfig} — Geolocation and filtering options
|
|
16
|
-
* - {@link AppConfig} — Application lifecycle options
|
|
17
|
-
* - {@link HttpConfig} — Networking and HTTP sync options
|
|
18
|
-
* - {@link PersistenceConfig} — Data persistence and database options
|
|
19
|
-
* - {@link LoggerConfig} — Logging and debugging options
|
|
20
|
-
* - {@link ActivityConfig} — Motion and activity-recognition options
|
|
21
|
-
*
|
|
22
|
-
* Instances of `Config` are consumed by {@link BackgroundGeolocation.ready}
|
|
23
|
-
* and {@link BackgroundGeolocation.setConfig}.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
*
|
|
27
|
-
* ```ts
|
|
28
|
-
* import BackgroundGeolocation, {
|
|
29
|
-
* Config,
|
|
30
|
-
* GeoConfig,
|
|
31
|
-
* ActivityConfig,
|
|
32
|
-
* HttpConfig,
|
|
33
|
-
* PersistenceConfig,
|
|
34
|
-
* DesiredAccuracy,
|
|
35
|
-
* PersistMode,
|
|
36
|
-
* LogLevel,
|
|
37
|
-
* AppConfig,
|
|
38
|
-
* LoggerConfig,
|
|
39
|
-
* State
|
|
40
|
-
* } from '{{pluginName}}';
|
|
41
|
-
*
|
|
42
|
-
* async function main() {
|
|
43
|
-
* // Configure the SDK with compound configuration objects.
|
|
44
|
-
* const config: Config = {
|
|
45
|
-
* geolocation: {
|
|
46
|
-
* desiredAccuracy: DesiredAccuracy.High,
|
|
47
|
-
* distanceFilter: 20,
|
|
48
|
-
* stopTimeout: 5,
|
|
49
|
-
* stationaryRadius: 150,
|
|
50
|
-
* },
|
|
51
|
-
* activity: {
|
|
52
|
-
* disableStopDetection: false,
|
|
53
|
-
* motionTriggerDelay: 30000,
|
|
54
|
-
* },
|
|
55
|
-
* http: {
|
|
56
|
-
* url: 'https://my.server.com/api/locations',
|
|
57
|
-
* method: 'POST',
|
|
58
|
-
* autoSync: true,
|
|
59
|
-
* headers: {
|
|
60
|
-
* Authorization: 'Bearer secret-token',
|
|
61
|
-
* },
|
|
62
|
-
* params: {
|
|
63
|
-
* user_id: 123,
|
|
64
|
-
* },
|
|
65
|
-
* },
|
|
66
|
-
* persistence: {
|
|
67
|
-
* persistMode: PersistMode.All,
|
|
68
|
-
* maxDaysToPersist: 14,
|
|
69
|
-
* extras: { appVersion: '1.0.0' },
|
|
70
|
-
* },
|
|
71
|
-
* app: {
|
|
72
|
-
* stopOnTerminate: false,
|
|
73
|
-
* startOnBoot: true,
|
|
74
|
-
* enableHeadless: true
|
|
75
|
-
* },
|
|
76
|
-
* logger: {
|
|
77
|
-
* debug: true,
|
|
78
|
-
* logLevel: LogLevel.Verbose,
|
|
79
|
-
* logMaxDays: 3,
|
|
80
|
-
* },
|
|
81
|
-
* };
|
|
82
|
-
*
|
|
83
|
-
* // Apply the configuration.
|
|
84
|
-
* const state: State = await BackgroundGeolocation.ready(config);
|
|
85
|
-
* console.log('[ready] BackgroundGeolocation is configured and ready to use');
|
|
86
|
-
*
|
|
87
|
-
* if (!state.enabled) {
|
|
88
|
-
* await BackgroundGeolocation.start();
|
|
89
|
-
* }
|
|
90
|
-
*
|
|
91
|
-
* // To modify configuration after initialization, use setConfig.
|
|
92
|
-
* const updated: State = await BackgroundGeolocation.setConfig({
|
|
93
|
-
* http: {
|
|
94
|
-
* headers: {
|
|
95
|
-
* Authorization: 'Bearer new-token',
|
|
96
|
-
* },
|
|
97
|
-
* },
|
|
98
|
-
* logger: {
|
|
99
|
-
* logLevel: LogLevel.Info
|
|
100
|
-
* },
|
|
101
|
-
* });
|
|
102
|
-
*
|
|
103
|
-
* await BackgroundGeolocation.sync();
|
|
104
|
-
* }
|
|
105
|
-
*
|
|
106
|
-
* ```
|
|
107
|
-
* @category Primary API
|
|
108
|
-
* @category Config
|
|
109
|
-
*/
|
|
110
9
|
export interface Config {
|
|
111
|
-
/**
|
|
112
|
-
* Reset the plugin to its initial state before applying this configuration. This is probably what you want.
|
|
113
|
-
*
|
|
114
|
-
* Defaults to `true`
|
|
115
|
-
*
|
|
116
|
-
* If you set this to `false`, the SDK will consume your `Config` only at the first install of your app. Thereafter, the only way
|
|
117
|
-
* to change your configuration will be to call {@link BackgroundGeolocation.setConfig},
|
|
118
|
-
*
|
|
119
|
-
* You will certainly **NOT** want to use `reset: false` during development, as it will prevent your configuration changes from taking effect on subsequent app launches.
|
|
120
|
-
*/
|
|
121
10
|
reset?: boolean;
|
|
122
|
-
/**
|
|
123
|
-
* Logger configuration.
|
|
124
|
-
*/
|
|
125
11
|
logger?: LoggerConfig;
|
|
126
|
-
/**
|
|
127
|
-
* Geolocation configuration.
|
|
128
|
-
*/
|
|
129
12
|
geolocation?: GeoConfig;
|
|
130
|
-
/**
|
|
131
|
-
* HTTP configuration.
|
|
132
|
-
*/
|
|
133
13
|
http?: HttpConfig;
|
|
134
|
-
/**
|
|
135
|
-
* App configuration.
|
|
136
|
-
*/
|
|
137
14
|
app?: AppConfig;
|
|
138
|
-
/**
|
|
139
|
-
* Persistence configuration.
|
|
140
|
-
*/
|
|
141
15
|
persistence?: PersistenceConfig;
|
|
142
|
-
/**
|
|
143
|
-
* Motion Activity configuration.
|
|
144
|
-
*/
|
|
145
16
|
activity?: ActivityConfig;
|
|
146
|
-
/**
|
|
147
|
-
* Authorization configuration.
|
|
148
|
-
*/
|
|
149
17
|
authorization?: AuthorizationConfig;
|
|
150
|
-
|
|
151
|
-
* *Convenience* option to automatically configures the SDK to upload locations to the Transistor Software demo server
|
|
152
|
-
* at http://tracker.transistorsoft.com (or your own local instance of [background-geolocation-console](https://github.com/transistorsoft/background-geolocation-console))
|
|
153
|
-
*
|
|
154
|
-
* See {@link TransistorAuthorizationService}. This option will **automatically configure** the {@link HttpConfig.url}
|
|
155
|
-
* to point at the Demo server as well as well as the required {@link AuthorizationConfig} configuration.
|
|
156
|
-
*
|
|
157
|
-
* @example
|
|
158
|
-
* ```typescript
|
|
159
|
-
* const token = await
|
|
160
|
-
* BackgroundGeolocation.findOrCreateTransistorAuthorizationToken("my-company-name", "my-username");
|
|
161
|
-
*
|
|
162
|
-
* BackgroundGeolocation.ready({
|
|
163
|
-
* transistorAuthorizationToken: token
|
|
164
|
-
* });
|
|
165
|
-
* ```
|
|
166
|
-
*
|
|
167
|
-
* This *convenience* option merely performs the following [[Authorization]] configuration *automatically* for you:
|
|
168
|
-
*
|
|
169
|
-
* @example
|
|
170
|
-
* ```typescript
|
|
171
|
-
* // Base url to Transistor Demo Server.
|
|
172
|
-
* const url = "http://tracker.transistorsoft.com";
|
|
173
|
-
*
|
|
174
|
-
* // Register for an authorization token from server.
|
|
175
|
-
* const token = await
|
|
176
|
-
* BackgroundGeolocation.findOrCreateTransistorAuthorizationToken("my-company-name", "my-username");
|
|
177
|
-
*
|
|
178
|
-
* BackgroundGeolocation.ready({
|
|
179
|
-
* url: url + "/api/locations",
|
|
180
|
-
* authorization: {
|
|
181
|
-
* strategy: "JWT",
|
|
182
|
-
* accessToken: token.accessToken,
|
|
183
|
-
* refreshToken: token.refreshToken,
|
|
184
|
-
* refreshUrl: url + "/v2/refresh_token",
|
|
185
|
-
* refreshPayload: {
|
|
186
|
-
* refresh_token: "{refreshToken}"
|
|
187
|
-
* },
|
|
188
|
-
* expires: token.expires
|
|
189
|
-
* }
|
|
190
|
-
* });
|
|
191
|
-
* ```
|
|
192
|
-
*
|
|
193
|
-
*/
|
|
194
|
-
transistorAuthorization?: TransistorAuthorizationToken;
|
|
18
|
+
transistorAuthorizationToken?: TransistorAuthorizationToken;
|
|
195
19
|
}
|