@oxyhq/core 1.11.20 → 1.11.22

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.
@@ -247,7 +247,7 @@ export function OxyServicesAuthMixin(Base) {
247
247
  */
248
248
  async verifyChallenge(publicKey, challenge, signature, timestamp, deviceName, deviceFingerprint) {
249
249
  try {
250
- return await this.makeRequest('POST', '/auth/verify', {
250
+ const res = await this.makeRequest('POST', '/auth/verify', {
251
251
  publicKey,
252
252
  challenge,
253
253
  signature,
@@ -255,6 +255,19 @@ export function OxyServicesAuthMixin(Base) {
255
255
  deviceName,
256
256
  deviceFingerprint,
257
257
  }, { cache: false });
258
+ // Plant the freshly-minted tokens, mirroring `claimSessionByToken`.
259
+ // `/auth/verify` returns the first access token (and refresh token) in
260
+ // its body, so installing it here means callers get an authenticated
261
+ // client without a second round-trip — and, critically, without
262
+ // falling back to the bearer-protected `GET /session/token/:sessionId`
263
+ // (C1 hardening), which 401s for a brand-new identity that has no
264
+ // bearer yet. `accessToken`/`refreshToken` are optional on
265
+ // SessionLoginResponse; only plant when an access token is present and
266
+ // default the refresh token to an empty string.
267
+ if (res?.accessToken) {
268
+ this.setTokens(res.accessToken, res.refreshToken ?? '');
269
+ }
270
+ return res;
258
271
  }
259
272
  catch (error) {
260
273
  throw this.handleError(error);