8000 GitHub - rohatucar/go-oauthdialog: A Go library to present an OAuth dialog to the user
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

A Go library to present an OAuth dialog to the user

License

Notifications You must be signed in to change notification settings

rohatucar/go-oauthdialog

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A Go library to present an OAuth dialog to the user

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%
0