Skip to content

Commit

Permalink
fix auth
Browse files Browse the repository at this point in the history
  • Loading branch information
ngoerlitz committed Apr 11, 2024
1 parent 3af4af1 commit 1add6f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions backend/src/controllers/login/LoginController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion backend/src/libraries/vatsim/ConnectLibrary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1add6f8

Please sign in to comment.