Hello,
Since I last dropped my node_modules and reinstalled them, an error appeared:
Buffer is not defined
In /modules/angular-auth-oidc-client.es5.js TokenHelperService.urlBase64Decode
The "compiled" code is the following:
TokenHelperService.prototype.urlBase64Decode = function (str) {
var /** @type {?} */ output = str.replace('-', '+').replace('_', '/');
switch (output.length % 4) {
case 0:
break;
case 2:
output += '==';
break;
case 3:
output += '=';
break;
default:
throw Error('Illegal base64url string!');
}
return new Buffer(output, 'base64').toString('binary');
};
But went I look at the source code, I see :
urlBase64Decode(str: string) {
let output = str.replace('-', '+').replace('_', '/');
switch (output.length % 4) {
case 0:
break;
case 2:
output += '==';
break;
case 3:
output += '=';
break;
default:
throw Error('Illegal base64url string!');
}
return typeof window !== 'undefined' ? window.atob(output) : new Buffer(output, 'base64').toString('binary');
}
I assume there is a release/publish problem, the package on npm not being the latest version ?
Best regards
I am also having this issue. It appears it was introduced in version 6.0.3. To help with the problem for now I updated my package.json to specify the following: "angular-auth-oidc-client": "6.0.2". This works for now.
@bereachad sorry, will fix this now. What browser are you using? I tested with the latest Edge, Firefox, Chrome versions.
@damienbod I tested in chrome, I am getting issues where it is stating that buffer is not defined when using version 6.0.3. If you want I can recreate issue locally and give you exact console output.
@bereachad, @Booster2ooo Thanks, I made a version 6.0.5 which should fix this, could you test this?
If this does not work, I will have to roll back the changes for the SSR support, which added this buffer change.
I will test later tonight.
Thanks Damien
@damienbod
Ran a test using 6.0.5, it appears to be working as of now. I also changed my package to use ^6.0.0 and all is still well. Thanks for the prompt response.
@Booster2ooo @bereachad
Thanks for reporting.
Most helpful comment
@damienbod
Ran a test using 6.0.5, it appears to be working as of now. I also changed my package to use
^6.0.0and all is still well. Thanks for the prompt response.