Categorygithub.com/go-oauth2/mysql
modulepackage
3.0.4+incompatible
Repository: https://github.com/go-oauth2/mysql.git
Documentation: pkg.go.dev

# README

MySQL Storage for OAuth 2.0

Build Codecov ReportCard GoDoc License

Install

$ go get -u -v gopkg.in/go-oauth2/mysql.v3

Usage

package main

import (
	"gopkg.in/go-oauth2/mysql.v3"
	"gopkg.in/oauth2.v3/manage"

	_ "github.com/go-sql-driver/mysql"
)

func main() {
	manager := manage.NewDefaultManager()

	// use mysql token store
	store := mysql.NewDefaultStore(
		mysql.NewConfig("root:123456@tcp(127.0.0.1:3306)/myapp_test?charset=utf8"),
	)

	defer store.Close()

	manager.MapTokenStorage(store)
	// ...
}

MIT License

Copyright (c) 2018 Lyric

# Functions

NewConfig create mysql configuration instance.
NewDefaultStore create mysql store instance.
NewStore create mysql store instance, config mysql configuration, tableName table name (default oauth2_token), GC time interval (in seconds, default 600).
NewStoreWithDB create mysql store instance, db sql.DB, tableName table name (default oauth2_token), GC time interval (in seconds, default 600).

# Structs

Config mysql configuration.
Store mysql token store.
StoreItem data item.