https://github.com/lddl/grpc-jwt
JWT recipe for gRPC-based server
https://github.com/lddl/grpc-jwt
authentication grpc grpc-client grpc-jwt grpc-server jwt jwt-authentication microservices
Last synced: 6 months ago
JSON representation
JWT recipe for gRPC-based server
- Host: GitHub
- URL: https://github.com/lddl/grpc-jwt
- Owner: LdDl
- License: mit
- Created: 2020-12-23T14:59:17.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-31T11:21:58.000Z (over 2 years ago)
- Last Synced: 2025-01-21T18:49:14.032Z (over 1 year ago)
- Topics: authentication, grpc, grpc-client, grpc-jwt, grpc-server, jwt, jwt-authentication, microservices
- Language: Go
- Homepage:
- Size: 42 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[](https://godoc.org/github.com/LdDl/grpc-jwt)
[](https://travis-ci.com/LdDl/grpc-jwt)
[](https://sourcegraph.com/github.com/LdDl/grpc-jwt?badge)
[](https://goreportcard.com/report/github.com/LdDl/grpc-jwt)
[](https://github.com/LdDl/grpc-jwt/releases)
# grpc-jwt - JWT recipe for gRPC-based server
### *preamble: almost all code for JWT stuff was taken from [appleyboy's](https://github.com/appleboy/gin-jwt#jwt-middleware-for-gin-framework) repository*
## Table of Contents
- [Usage](#usage)
- [Server](#server-example)
- [Client](#client-example)
- [Support](#support)
- [Dependencies](#dependencies)
- [License](#license)
## **Usage**
If you are planning to use private/public keys, you should generate it first. There is example of generting RS512 keys below:
```shell
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS512.key
openssl rsa -in jwtRS512.key -pubout -outform PEM -out jwtRS512.key.pub
```
If you want to re-build *.pb.go files
```bash
protoc -I . ./*.proto --go_out=./ --go-grpc_out=./ --go-grpc_opt=paths=source_relative --experimental_allow_proto3_optional
```
### **Server example**
Whole example for server-side is [here](cmd/server/main.go)
How to run server-side:
```shell
go run .
```
### **Client example**
Whole example for client-side is [here](cmd/client/main.go)
How to run client-side:
```shell
go run .
```
## **Support**
If you have troubles or questions please [open an issue](https://github.com/LdDl/grpc-jwt/issues/new).
PRs are welcome!
## **Dependencies**
* github.com/golang-jwt/jwt - License is [MIT](https://github.com/golang-jwt/jwt/blob/master/LICENSE)
* gRPC and protobuf for doing "'client-server'" application - [grpc](https://github.com/grpc/grpc-go). License is Apache-2.0
## **License**
You can check it [here](https://github.com/LdDl/grpc-jwt/blob/master/LICENSE.md)