Skip to content

Repository files navigation

Hyperscale gRPC OAuth Last releaseDocumentation

Go Report Card

BranchStatusCoverage
masterBuild StatusCoveralls

The Hyperscale grpcoauth library provides a simple gRPC credentials.PerRPCCredentials with OAuth

Example

package main
import (
"github.com/hyperscale-stack/grpcoauth"
)
funcmain() {
cert:=...authF:=func(ctx context.Context, creds*OAuthCredentials) (context.Context, error) {
// implements your business logic for authenticate// creds contains AccessToken or ClientID and ClientSecretreturnctx, nil
}
opts:= []grpc.ServerOption{
grpc.Creds(credentials.NewServerTLSFromCert(&cert)),
grpc.UnaryInterceptor(UnaryServerInterceptor(authF)),
}
gsrv:=grpc.NewServer(opts...)
// init gRPC Dial and init servicegreeter:=...
_, err=greeter.SayHello(ctx, &greeterv1.SayHelloRequest{}, grpcoauth.PerRPCTokenCredentials("feadbb35-c2be-4529-b2a6-19109e07eaa3"))
}

License

Hyperscale grpcoauth is licensed under the MIT license.

About

A gRPC OAuth2 module for Golang

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages