modulepackage
0.0.0-20150903111122-1adb5ce0720b
Repository: https://github.com/macaron-contrib/oauth2.git
Documentation: pkg.go.dev
# README
oauth2
Middleware oauth2 provides support of user login via an OAuth 2.0 backend for Macaron.
It currently support Google, GitHub, LinkedIn, Dropbox, Facebook, Weibo and QQ.
Usage
// ...
m.Use(oauth2.GitHub(oauth2.Options{
ClientID: "CLIENT_ID",
ClientSecret: "CLIENT_SECRET",
Scopes: []string{"SCOPE"},
PathLogin: "/user/login/oauth2/github",
PathCallback: "/user/login/github",
RedirectURL: "http://localhost:3000/user/login/github",
}))
// ...
Credits
This package is forked from golang/oauth2 and martini-contrib/oauth2 with modifications.
License
This project is under Apache v2 License. See the LICENSE file for the full license text.
# Packages
Package jws provides encoding and decoding utilities for signed JWS messages.
# Functions
No description provided by the author
No description provided by the author
GitHub returns a new Github OAuth 2.0 backend endpoint.
Google returns a new Google OAuth 2.0 backend endpoint.
No description provided by the author
New builds a new options object and determines the type of the OAuth 2.0 (2-legged, 3-legged or custom) by looking at the provided options.
NewOAuth2Provider returns a generic OAuth 2.0 backend endpoint.
ParseKey converts the binary contents of a private key file to an *rsa.PrivateKey.
No description provided by the author
No description provided by the author
# Variables
No description provided by the author
Handler that redirects user to the login page if user is not logged in.
PathCallback is the path to handle callback from OAuth 2.0 backend to exchange credentials.
PathError is the path to handle error cases.
PathLogin is the path to handle OAuth 2.0 logins.
PathLogout is the path to handle OAuth 2.0 logouts.
# Interfaces
Tokens represents a container that contains user's OAuth 2.0 access and refresh tokens.
TokenStore implementations read and write OAuth 2.0 tokens from a persistence layer.