From 06986f2c70625a96fe58d34b34a3123d5cb64b41 Mon Sep 17 00:00:00 2001 From: Endel Dreyer Date: Fri, 22 Dec 2023 15:07:19 -0300 Subject: [PATCH] forward existing token during OAuth for upgrade. --- package.json | 2 +- src/Auth.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0a6b2a2..e0dbb42 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "colyseus.js", - "version": "0.15.15-preview.21", + "version": "0.15.15-preview.22", "description": "Colyseus Multiplayer SDK for JavaScript/TypeScript", "author": "Endel Dreyer", "license": "MIT", diff --git a/src/Auth.ts b/src/Auth.ts index a178910..2c20df0 100644 --- a/src/Auth.ts +++ b/src/Auth.ts @@ -114,9 +114,12 @@ export class Auth { const w = settings.width || 480; const h = settings.height || 768; + // forward existing token for upgrading + const upgradingToken = this.token ? `?token=${this.token}` : ""; + // Capitalize first letter of providerName const title = `Login with ${(providerName[0].toUpperCase() + providerName.substring(1))}`; - const url = this.http['client']['getHttpEndpoint'](`${(settings.prefix || `${this.settings.path}/provider`)}/${providerName}`); + const url = this.http['client']['getHttpEndpoint'](`${(settings.prefix || `${this.settings.path}/provider`)}/${providerName}${upgradingToken}`); const left = (screen.width / 2) - (w / 2); const top = (screen.height / 2) - (h / 2);