From 4d4ed8c1ea774c07936c7cdefdc22db7e4d436fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Thu, 6 Aug 2026 16:35:11 -0500 Subject: [PATCH] Upgrade to oauth2-pkce 3 Bump oauth2-pkce from ^2.1.3 to ^3.0.0. In v3, getTokens() throws ErrorAccessTokenExpired when the token has expired and no onAccessTokenExpiry handler is configured. Add the handler to the OSM auth client config so it automatically refreshes via the refresh token instead of throwing --- app/services/osm-auth.js | 3 +++ package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/services/osm-auth.js b/app/services/osm-auth.js index 96cb0c2..d8b56d6 100644 --- a/app/services/osm-auth.js +++ b/app/services/osm-auth.js @@ -45,6 +45,9 @@ export default class OsmAuthService extends Service { clientId: clientId, redirectUrl: redirectUrl, storeRefreshToken: true, + onAccessTokenExpiry() { + return this.exchangeRefreshTokenForAccessToken(); + }, }, new MarcoOsmAuthStorage() ); diff --git a/package.json b/package.json index 11af17e..02ff8fb 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "ember-concurrency": "^5.2.0", "ember-lifeline": "^7.1.0", "nostr-idb": "^5.1.0", - "oauth2-pkce": "^2.1.3", + "oauth2-pkce": "^3.0.0", "qrcode": "^1.5.4", "rxjs": "^7.8.2" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 42def3a..2305d58 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -41,8 +41,8 @@ importers: specifier: ^5.1.0 version: 5.1.0 oauth2-pkce: - specifier: ^2.1.3 - version: 2.1.3 + specifier: ^3.0.0 + version: 3.0.0 qrcode: specifier: ^1.5.4 version: 1.5.4 @@ -4470,8 +4470,8 @@ packages: nwsapi@2.2.23: resolution: {integrity: sha512-7wfH4sLbt4M0gCDzGE6vzQBo0bfTKjU7Sfpqy/7gs1qBfYz2vEJH6vXcBKpO3+6Yu1telwd0t9HpyOoLEQQbIQ==} - oauth2-pkce@2.1.3: - resolution: {integrity: sha512-DcMiG5XUKNabf0qV1GOEPo+zwIdYsO2K1FMhiP8XnSCJbujZLOnSC5BCYiCtD0le+aue2fK6qDDvGjcQNF53jQ==} + oauth2-pkce@3.0.0: + resolution: {integrity: sha512-WRqq62rSzWApB4dhttxKJRpgK2GMCeonseH7K567wl9jTI6s9q8dUHrZQpfAlE0NN2FN5WVOF0RvvDtL5+xB6w==} object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} @@ -10827,7 +10827,7 @@ snapshots: nwsapi@2.2.23: {} - oauth2-pkce@2.1.3: {} + oauth2-pkce@3.0.0: {} object-assign@4.1.1: {}