oauth2

package module
v0.0.0-...-78518a5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

README

OAuth2

OAuth2 helps process oauth2 connections

Build Status codecov

Getting Started

oauth2 gives you functions to run through the complete flow

Prerequisites

Here are the things that you would require before you get started

  1. Install git
  2. Install golang
Using Oauth2

You can install it into your project using

dep ensure -add github.com/build-tanker/oauth2
Installing

Clone the repo and build it

git clone https://github.com/build-tanker/oauth2.git
make build

Running the tests

If you would like to run the automated tests for the complete package, run this

make coverage
open ./coverage.html
And coding style tests

We use the default golang coding conventions. Run the following to test for those

make fmt
make vet
make lint

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning based on the recommendation from Dave Chaney. For the versions available, see the tags on this repository.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OAuth2

type OAuth2 interface {
	GetAuthURL(scope, accessType, state, includeGrantedScopes, loginHint, prompt string) (string, error)
	GetToken(code string) ([]byte, error)
	VerifyToken(accessToken string) (string, error)
	RefreshToken(refreshToken string) (string, error)
	RevokeToken(accessToken string) error
	GetProfileDetails(accessToken string) (ProfileDetails, error)
	GetAndVerifyToken(code string) (VerifyDetails, error)
}

OAuth2 interface to deal with OAuth2

func NewOAuth2

func NewOAuth2(clientID, clientSecret, redirectURL string) (OAuth2, error)

NewOAuth2 - get a new client for OAuth2

type ProfileDetails

type ProfileDetails struct {
	Email  string
	Name   string
	Image  string
	ID     string
	Gender string
}

ProfileDetails stores the details fetched from the profile call

type VerifyDetails

type VerifyDetails struct {
	AccessToken  string
	TokenType    string
	ExpiresIn    int64
	RefreshToken string
	IDToken      string
	UserID       string
}

VerifyDetails stores the details for verifing an account

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL