Categorygithub.com/jasacloud/go-oauth2mongo
modulepackage
0.0.0-20240404063702-35577963a641
Repository: https://github.com/jasacloud/go-oauth2mongo.git
Documentation: pkg.go.dev

# README

Mongo Storage for OAuth 2.0 with official driver

Build Codecov ReportCard GoDoc License

Install

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

Usage

package main

import (
	"github.com/jasacloud/go-libraries/db/mongoc"
	"github.com/jasacloud/go-oauth2mongo"
	"gopkg.in/oauth2.v3/manage"
)

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

	conn, err := mongoc.NewConnection("accounts")
	if err != nil {
		panic(err)
	}

	// use mongodb token store
	manager.MapTokenStorage(
		oauth2mongo.NewTokenStore(conn),
	)
	manager.MapClientStorage(
		oauth2mongo.NewClientStore(conn),
	)
	// ...
}

MIT License

Copyright (c) 2020 Jasacloud

# Functions

NewClientStore create a client store instance based on mongodb.
NewClientStoreWithSession create a client store instance based on mongodb.
NewConfig create mongodb configuration.
NewDefaultClientConfig create a default client configuration.
NewDefaultTokenConfig create a default token configuration.
NewTokenStore create a token store instance based on mongodb.
NewTokenStoreWithSession create a token store instance based on mongodb.

# Structs

ClientConfig client configuration parameters.
ClientStore MongoDB storage for OAuth 2.0.
Config mongodb configuration parameters.
No description provided by the author
TokenConfig token configuration parameters.
TokenStore MongoDB storage for OAuth 2.0.