Skip to content

Commit 5230cde

Browse files
authored
Merge pull request #436 from ngouy/hide-token-on-debug
feat(client): obfuscate token while logging in debug mode
2 parents b1f4683 + f39d050 commit 5230cde

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/clients/transporter.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,19 @@ const defaultTransportConfig = {
2323
};
2424
},
2525
};
26+
27+
const obfuscateToken = (options) => {
28+
if (!options.token) return options;
29+
30+
return {
31+
...options,
32+
token: options.token.slice(0, 5) + '**********',
33+
};
34+
};
35+
2636
class Transporter {
2737
constructor(options, sideLoad = [], useDotJson = true) {
28-
this.options = options;
38+
this.options = obfuscateToken(options);
2939
this.sideLoad = sideLoad;
3040
this.useDotJson = useDotJson;
3141
this.authHandler = new AuthorizationHandler(this.options);

0 commit comments

Comments
 (0)