Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/ankr-network/oauth2-redis

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/ankr-network/oauth2-redis

  • v1.1.0
  • Source
  • Go
  • Socket score

Version published
Created
Source

Redis Storage for OAuth 2.0

forked from go-oauth2/redis, supported get by user id and remove by user id.

Install

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

Usage

package main

import (
	"github.com/go-redis/redis"
	oredis "github.com/Ankr-network/oauth2-redis"
	"gopkg.in/oauth2.v3/manage"
)

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

	// get token by user id
	// t, _ := tokenStore.GetByUID("test") // get token info by user id
	// _ := tokenStore.RemoveByUID("test") // remove access token and refresh token by uid

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

FAQs

Package last updated on 17 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc