Categorygithub.com/aadityachaudhary/go-oauthdialog
modulepackage
0.0.0-20200802164750-2564184906d6
Repository: https://github.com/aadityachaudhary/go-oauthdialog.git
Documentation: pkg.go.dev

# README

go-oauthdialog

GoDoc

A Go library to present an OAuth2 dialog to the user.

Usage

package main

import (
	"log"

	"github.com/emersion/go-oauthdialog"
	"golang.org/x/oauth2"
	"golang.org/x/oauth2/google"
)

func main() {
	conf := &oauth2.Config{
		ClientID: "CLIENT_ID",
		ClientSecret: "CLIENT_SECRET",
		Scopes: []string{"https://mail.google.com"},
		Endpoint: google.Endpoint,
	}

	code, err := oauthdialog.Open(conf)
	if err != nil {
		log.Fatal(err)
	}

	tok, err := conf.Exchange(oauth2.NoContext, code)
	if err != nil {
		log.Fatal(err)
	}

	log.Println("Token:", tok)
}

License

MIT

# Functions

Create a new OAuth2 dialog.
Create a new OAuth2 dialog and open it.

# Variables

OAuth2 errors defined in RFC 6749 section 4.1.2.1.
OAuth2 errors defined in RFC 6749 section 4.1.2.1.
OAuth2 errors defined in RFC 6749 section 4.1.2.1.
OAuth2 errors defined in RFC 6749 section 4.1.2.1.
OAuth2 errors defined in RFC 6749 section 4.1.2.1.
OAuth2 errors defined in RFC 6749 section 4.1.2.1.
OAuth2 errors defined in RFC 6749 section 4.1.2.1.

# Structs

An OAuth2 dialog.