Redis Storage for OAuth 2.0
$ go get -u -v gopkg.in/go-oauth2/redis.v3
package main
import (
"github.com/go-redis/redis"
oredis "gopkg.in/go-oauth2/redis.v3"
"gopkg.in/oauth2.v3/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,
// }))
}
Copyright (c) 2016 Lyric