/go-oauth2-postgres

Postgres Storage for OAuth 2.0 inspired by go-oauth2-mysql.

Primary LanguageGoMIT LicenseMIT

Postgres Storage for OAuth 2.0

GoDoc License

Install

$ go get -v github.com/JonathanMonga/go-oauth2-postgres

Usage

package main

import (
	"github.com/JonathanMonga/go-oauth2-postgres"
	"github.com/go-oauth2/oauth2/v4/manage"

	_ "github.com/lib/pq"
)

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

	// use postgres token store
	store := postgres.NewDefaultStore(
		postgres.NewConfig("postgres://postgres:password@localhost/myapp_test?sslmode=disable"),
	)

	defer store.Close()

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

MIT License

Copyright (c) 2023 Jonathan Monga