auth: Fix base64url transformation

The problem was that replace only replaces the first occurrence of a string and not all as is needed for this function.
tsconfig.json needed lib to be set to esnext or the replaceAll function won't be available…

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2021-01-26 10:18:52 +01:00 committed by David Mehren
parent 06768e33f5
commit 1791cb7c82
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
2 changed files with 5 additions and 4 deletions

View file

@ -70,9 +70,9 @@ export class AuthService {
// base64url is quite easy buildable from base64
return text
.toString('base64')
.replace('+', '-')
.replace('/', '_')
.replace(/=+$/, '');
.replaceAll(/\+/g, '-')
.replaceAll(/\//g, '_')
.replaceAll(/=+$/g, '');
}
async createTokenForUser(

View file

@ -10,6 +10,7 @@
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true
"incremental": true,
"lib": ["esnext"]
}
}