Skip to content

Latest commit

 

History

History
54 lines (42 loc) · 1.56 KB

README.md

File metadata and controls

54 lines (42 loc) · 1.56 KB

Redis Storage for OAuth 2.0

Build Codecov ReportCard GoDoc License

Install

$ go get -u -v github.com/go-oauth2/redis/v4

Usage

package main

import (
	"github.com/go-redis/redis/v8"
	oredis "github.com/go-oauth2/redis/v4"
	"github.com/go-oauth2/oauth2/v4/manage"
)

func main() {
	manager := manage.NewDefaultManager()
	
	// use redis token store
	manager.MapTokenStorage(oredis.NewRedisStore(&redis.Options{
		Addr: "127.0.0.1:6379",
		DB: 15,
	}))

	// use redis cluster store
	// manager.MapTokenStorage(oredis.NewRedisClusterStore(&redis.ClusterOptions{
	// 	Addrs: []string{"127.0.0.1:6379"},
	// 	DB: 15,
	// }))
}

MIT License

Copyright (c) 2020 Lyric