diff --git a/backend/src/controllers/login/LoginController.ts b/backend/src/controllers/login/LoginController.ts index 73c5e22..529e9db 100644 --- a/backend/src/controllers/login/LoginController.ts +++ b/backend/src/controllers/login/LoginController.ts @@ -23,16 +23,16 @@ const connect_options: ConnectOptions = { function getRedirectUri(request: Request, response: Response) { const connectConfig = Config.CONNECT_CONFIG; - response.send( - [ - connectConfig.BASE_URL, - "/oauth/authorize", - `?client_id=${connectConfig.CLIENT_ID}`, - `&redirect_uri=${encodeURI(connectConfig.REDIRECT_URI ?? "")}`, - "&response_type=code", - `&scope=${connectConfig.SCOPE.split(" ").join("+")}`, - ].join("") - ); + const uri = [ + connectConfig.BASE_URL, + "/oauth/authorize", + `?client_id=${connectConfig.CLIENT_ID}`, + `&redirect_uri=${encodeURI(connectConfig.REDIRECT_URI ?? "")}`, + "&response_type=code", + `&scope=${encodeURI(connectConfig.SCOPE.split(",").join(" "))}`, + ].join("") + + response.send(uri); } /** diff --git a/backend/src/libraries/vatsim/ConnectLibrary.ts b/backend/src/libraries/vatsim/ConnectLibrary.ts index 1b3b6ba..c0c298f 100644 --- a/backend/src/libraries/vatsim/ConnectLibrary.ts +++ b/backend/src/libraries/vatsim/ConnectLibrary.ts @@ -264,7 +264,7 @@ export class VatsimConnectLibrary { private _validateSuppliedScopes() { if (this.m_suppliedScopes == null) throw new VatsimConnectException(); - const required_scopes = this.m_connectOptions?.client_scopes.split(" ") as VatsimScopes; + const required_scopes = this.m_connectOptions?.client_scopes.split(",") as VatsimScopes; for (let i = 0; i < required_scopes.length; i++) { if (this.m_suppliedScopes.indexOf(required_scopes[i]) === -1) { throw new VatsimConnectException(ConnectLibraryErrors.ERR_INV_SCOPES);