All Projects → cristalhq → Oauth2

cristalhq / Oauth2

Licence: mit
OAuth2 client in Go

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Oauth2

Auth
Authenticator via oauth2
Stars: ✭ 118 (+490%)
Mutual labels:  authentication, oauth2, oauth2-client
Retroauth
A library build on top of retrofit, for simple handling of authenticated requests
Stars: ✭ 405 (+1925%)
Mutual labels:  authentication, oauth2, oauth2-client
Auth0.js
Auth0 headless browser sdk
Stars: ✭ 755 (+3675%)
Mutual labels:  authentication, oauth2
Product Is
Welcome to the WSO2 Identity Server source code! For info on working with the WSO2 Identity Server repository and contributing code, click the link below.
Stars: ✭ 435 (+2075%)
Mutual labels:  authentication, oauth2
Play Silhouette
Silhouette is an authentication library for Play Framework applications that supports several authentication methods, including OAuth1, OAuth2, OpenID, CAS, 2FA, TOTP, Credentials, Basic Authentication or custom authentication schemes.
Stars: ✭ 826 (+4030%)
Mutual labels:  authentication, oauth2
Pizzly
The simplest, fastest way to integrate your app with an OAuth API 😋
Stars: ✭ 796 (+3880%)
Mutual labels:  authentication, oauth2
Omniauth Oauth2
An abstract OAuth2 strategy for OmniAuth.
Stars: ✭ 430 (+2050%)
Mutual labels:  authentication, oauth2
Doorkeeper
Doorkeeper is an OAuth 2 provider for Ruby on Rails / Grape.
Stars: ✭ 4,917 (+24485%)
Mutual labels:  authentication, oauth2
Oauth
🔗 OAuth 2.0 implementation for various providers in one place.
Stars: ✭ 336 (+1580%)
Mutual labels:  authentication, oauth2
Next Auth
Authentication for Next.js
Stars: ✭ 8,362 (+41710%)
Mutual labels:  authentication, oauth2
Angular Oauth2
AngularJS OAuth2
Stars: ✭ 601 (+2905%)
Mutual labels:  authentication, oauth2
Django Graphql Jwt
JSON Web Token (JWT) authentication for Graphene Django
Stars: ✭ 649 (+3145%)
Mutual labels:  authentication, oauth2
Oauth2
Go OAuth2
Stars: ✭ 3,941 (+19605%)
Mutual labels:  oauth2, oauth2-client
Jso
Easy to use OAuth 2.0 javascript library for use in your javascript application.
Stars: ✭ 830 (+4050%)
Mutual labels:  authentication, oauth2
Gin Oauth2
Middleware for Gin Framework users who also want to use OAuth2
Stars: ✭ 351 (+1655%)
Mutual labels:  authentication, oauth2
Cloudfront Auth
An AWS CloudFront [email protected] function to authenticate requests using Google Apps, Microsoft, Auth0, OKTA, and GitHub login
Stars: ✭ 471 (+2255%)
Mutual labels:  authentication, oauth2
Spring Boot React Oauth2 Social Login Demo
Spring Boot React OAuth2 Social Login with Google, Facebook, and Github
Stars: ✭ 676 (+3280%)
Mutual labels:  authentication, oauth2
Django Oidc Provider
OpenID Connect and OAuth2 provider implementation for Djangonauts.
Stars: ✭ 320 (+1500%)
Mutual labels:  authentication, oauth2
React Aad
A React wrapper for Azure AD using the Microsoft Authentication Library (MSAL). The easiest way to integrate AzureAD with your React for authentication.
Stars: ✭ 324 (+1520%)
Mutual labels:  authentication, oauth2
Angular Auth Oidc Client
npm package for OpenID Connect, OAuth Code Flow with PKCE, Refresh tokens, Implicit Flow
Stars: ✭ 577 (+2785%)
Mutual labels:  authentication, oauth2

oauth2

build-img pkg-img reportcard-img coverage-img

OAuth2 client in Go.

Features

  • Simple API.
  • Tiny codebase.
  • Dependency-free.

Install

Go version 1.13

go get github.com/cristalhq/oauth2

Example

config := oauth2.Config{
    ClientID:     "YOUR_CLIENT_ID",
    ClientSecret: "YOUR_CLIENT_SECRET",
    AuthURL:      "https://provider.com/o/oauth2/auth",
    TokenURL:     "https://provider.com/o/oauth2/token",
    Scopes:       []string{"email", "avatar"},
}

// create a client
client := oauth2.NewClient(http.DefaultClient, config)

// url to fetch the code
url := client.AuthCodeURL("state")
fmt.Printf("Visit the URL for the auth dialog: %v", url)

// Use the authorization code that is pushed to the redirect URL.
// Exchange will do the handshake to retrieve the initial access token.
var code string
if _, err := fmt.Scan(&code); err != nil {
    log.Fatal(err)
}

// get a token
token, err := client.Exchange(context.Background(), code)
if err != nil {
    panic(err)
}

var _ string = token.AccessToken  // OAuth2 token
var _ string = token.TokenType    // type of the token
var _ string = token.RefreshToken // token for a refresh
var _ time.Time = token.Expiry    // token expiration time
var _ bool = token.IsExpired()    // have token expired?

Documentation

See these docs.

License

MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].