Fixed issue with credentials that have special chars

This commit is contained in:
Giuseppe Digilio
2018-05-29 10:51:07 +02:00
parent 7d8324d701
commit 66295d10ed
3 changed files with 29 additions and 11 deletions

View File

@@ -0,0 +1,10 @@
/**
* use this to make a Base64 encoded string URL friendly,
* i.e. '+' and '/' are replaced with special percent-encoded hexadecimal sequences
*
* @param {String} str the encoded string
* @returns {String} the URL friendly encoded String
*/
export function Base64EncodeUrl(str): string {
return str.replace(/\+/g, '%2B').replace(/\//g, '%2F').replace(/\=/g, '%3D');
}