go-oauth2-providers is a Go library for OAuth2 authentication integration. It provides a unified interface to create OAuth2 provider instances and retrieve user information, and supports multiple providers, including Google, Facebook, and GitHub. It's extensively tested and can be used in projects of any size.
To install the go-oauth2-providers
package, you can use the go get
command:
go get github.com/Zhima-Mochi/go-oauth2-providers
The go-oauth2-providers
package currently supports the following OAuth2 providers:
- GitHub
- Line
Each provider implementation includes files such as provider_xxx.go
, config_provider.go
, options_provider.go
, authCodeOption.go
, token.go
, and user.go
, along with other utility files. These files provide the necessary logic and structures for interacting with the respective OAuth2 provider.
The go-oauth2-providers
package includes the following components:
-
Auth
- TheAuth
component is the main component of thego-oauth2-providers
package. It contains all the necessary information for interacting with an OAuth2 provider, including retrieving the authorization URL, exchanging the authorization code for an access token, and retrieving the user information. -
Provider
- TheProvider
component is the factory for creatingAuth
instances. It contains the necessary information for creating anAuth
instance, including the provider's name, configuration, and options.
See Example for a simple example of how to use the go-oauth2-providers
package.
This project is licensed under the MIT License. See the LICENSE file for more details.