docs: add authorize options
This commit is contained in:
parent
55a5f71b6e
commit
d01bcc29fa
@ -87,6 +87,11 @@ io.on('connection', async (socket) => {
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### `authorize` options
|
||||||
|
|
||||||
|
- `secret` is a string containing the secret for HMAC algorithms, or a function that should fetch the secret or public key as shown in the example with `jwks-rsa`.
|
||||||
|
- `algorithms` (default: `HS256`)
|
||||||
|
|
||||||
### Client side
|
### Client side
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
@ -59,7 +59,6 @@ export const authorize = (options: AuthorizeOptions): SocketIOMiddleware => {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// Store encoded JWT
|
|
||||||
socket.encodedToken = encodedToken
|
socket.encodedToken = encodedToken
|
||||||
let keySecret: string | null = null
|
let keySecret: string | null = null
|
||||||
let decodedToken: any
|
let decodedToken: any
|
||||||
@ -78,7 +77,6 @@ export const authorize = (options: AuthorizeOptions): SocketIOMiddleware => {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// Store decoded JWT
|
|
||||||
socket.decodedToken = decodedToken
|
socket.decodedToken = decodedToken
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user