Commit dedbd32
BitGo Agent
fix(sdk-api): guard v1 auth path against undefined accessToken in testnet
When BitGoAPI is constructed with accessToken: undefined (e.g.
TESTNET_ACCESS_TOKEN env var not set) and a request sets
forceV1Auth = true, the v1 auth condition previously evaluated as:
(undefined && ...) || true → true
causing the request to set Authorization: 'Bearer undefined',
which the server rejects with an 'undefined access token' error.
Fix: require this._token to be truthy before entering the v1 path,
so forceV1Auth cannot bypass the token guard. Unauthenticated
requests now proceed without an Authorization header (the existing
behaviour for requests with no token) rather than sending a
literally-undefined bearer value.
Ticket: WCI-1213
Session-Id: 90ff7750-f83b-4600-a00a-fb07afa1cb4a
Task-Id: a55a5860-e651-49e1-9ea1-0867be6b19d31 parent f7b8d3a commit dedbd32
2 files changed
Lines changed: 43 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
645 | 645 | | |
646 | 646 | | |
647 | 647 | | |
648 | | - | |
| 648 | + | |
649 | 649 | | |
650 | 650 | | |
651 | 651 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1192 | 1192 | | |
1193 | 1193 | | |
1194 | 1194 | | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
0 commit comments