# README
GoAuth
GoAuth provides helper libraries for authentication in Go, with a focus on API services. It covers OAuth 2.0, JWT, TLS client authentication and Basic Auth. A primary goal is to be able to create a *http.Client
from a single JSON application definition.
Major features include:
- The base
goauth
package is designed to provide a single file format for handling configuration of all methods of authentication, including BasicAuth, OAuth 2.0, and JWT credentials. The primary use case is to have a single JSON definition of multiple applications for multiple services which can be used to generate token and API requests. It works withgoauth/endpoints
to add endpoints for known services. - Create
*http.Client
for multiple API services. UseNewClient()
functions to create*http.Client
structs for services not supported inoauth2
likeaha
,metabase
,ringcentral
,salesforce
,visa
, etc. Generating*http.Client
structs is especially useful for using with Swagger Codegen auto-generated SDKs to support different auth models. - Create OAuth 2.0 authorization code token from the command line (for test purposes). No website is needed.
- Retrieve canonical user information via helper libraries to retrieve canonical user information from services. The SCIM user schema is used for a canonical user model. This may be replaced/augmented by OIDC
userinfo
in the future. - Transparently handle OAuth 2 for multiple services, e.g. a website that supports Google and Facebook auth. This is demoed in
github.com/grokify/beegoutil
Installation
$ go get github.com/grokify/goauth
Usage
Canonical User Information
ClientUtil
structs satisfy the interface having SetClient()
and GetSCIMUser()
functions.
import(
"github.com/grokify/goauth/google"
)
// googleOAuth2HTTPClient is *http.Client from Golang OAuth2
googleClientUtil := google.NewClientUtil(googleOAuth2HTTPClient)
scimuser, err := googleClientUtil.GetSCIMUser()
import(
"github.com/grokify/goauth/facebook"
)
// fbOAuth2HTTPClient is *http.Client from Golang OAuth2
fbClientUtil := facebook.NewClientUtil(fbOAuth2HTTPClient)
scimuser, err := fbClientUtil.GetSCIMUser()
RingCentral
import(
"github.com/grokify/goauth/ringcentral"
)
// rcOAuth2HTTPClient is *http.Client from Golang OAuth2
rcClientUtil := ringcentral.NewClientUtil(rcOAuth2HTTPClient)
scimuser, err := rcClientUtil.GetSCIMUser()
Test Redirect URL
This repo comes with a generic test OAuth 2 redirect page which can be used with headless (no-UI) apps. To use this test URL, configure the following URL to be your OAuth 2 redirect URI. This will write the Authorization Code in the HTMl which you can then copy and paste into your own app.
The URL is located here:
Example App
See the following repo for a Beego-based demo app:
# Packages
No description provided by the author
auth0 contains a Go implementation of Auth0's PKCE support: https://auth0.com/docs/api-auth/tutorials/authorization-code-grant-pkce.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Google Cloud Platform Service Account.
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
CredentialsOAuth2 supports OAuth 2.0 authorization_code, password, and client_credentials grant flows.
No description provided by the author
No description provided by the author
CredentialsOAuth2 supports OAuth 2.0 authorization_code, password, and client_credentials grant flows.
No description provided by the author
Options is a struct to be used with `ParseOptions()` or `github.com/jessevdk/go-flags`.
# Type aliases
No description provided by the author