From 6af672cca28d025038ffcd409ede6691f4fcb85c Mon Sep 17 00:00:00 2001 From: Kerollos Magdy Date: Tue, 29 Oct 2019 12:23:42 +0200 Subject: [PATCH 1/2] fix a minor grammar mistake in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3d6f6f9..8354917 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Thanks goes to these wonderful people who contribute(d) or maintain(ed) this rep ## Intro -Authenticate socket.io incoming connections with JWTs. This is useful if you are build a single page application and you are not using cookies as explained in this blog post: [Cookies vs Tokens. Getting auth right with Angular.JS](http://blog.auth0.com/2014/01/07/angularjs-authentication-with-cookies-vs-token/). +Authenticate socket.io incoming connections with JWTs. This is useful if you are building a single page application and you are not using cookies as explained in this blog post: [Cookies vs Tokens. Getting auth right with Angular.JS](http://blog.auth0.com/2014/01/07/angularjs-authentication-with-cookies-vs-token/). This repo is supported and maintained by Community Developers, not Auth0. For more information about different support levels check https://auth0.com/docs/support/matrix . From bcf6c0b719360b7815ea73ac8622eeec0427f13c Mon Sep 17 00:00:00 2001 From: Kerollos Magdy Date: Tue, 29 Oct 2019 12:39:38 +0200 Subject: [PATCH 2/2] add example for using customDecoded function --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 8354917..b5c9d15 100644 --- a/README.md +++ b/README.md @@ -251,6 +251,29 @@ io.use(socketioJwt.authorize({ })); ``` +### Altering the value of the decoded token + +You can pass a function to change the value of the decoded token + +```javascript + +io.on( + 'connection', + socketIOJwt.authorize({ + customDecoded: (decoded) => { + return "new decoded token"; + }, + secret: 'my_secret_key', + decodedPropertyName: 'my_decoded_token', + }), +); + +io.on('authenticated', (socket) => { + console.log(socket.my_decoded_token); // new decoded token +}); + +``` + ## Contribute Feel like contributing to this repo? We're glad to hear that! Before you start contributing please visit our [Contributing Guideline](https://github.com/auth0-community/getting-started/blob/master/CONTRIBUTION.md).