Description

OAuth2 implementation compatible with vibe.d

Package Information

Version0.1.4 (2017-Mar-13)
Repositoryhttps://github.com/thaven/oauth
LicenseMIT
CopyrightCopyright © 2016 Harry T. Vennik
AuthorsHarry T. Vennik
Registered byHarry T. Vennik
Dependencies

vibe-d:core

vibe-d:http

vibe-d:data

Installation

To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

Readme

OAuth

The oauth package provides an implementation of the OAuth 2.0 Authorization framework.

This package is in early development phase. Subsequent versions may not be fully compatible. Especially between versions 0.0.1 and 0.1.0 the API changed a lot.

API Overview

Full documentation is in the source, here is just an overview of the 0.1.0+ API.

You'll need at least one OAuthProvider. Support for Facebook, Google and Azure is included, though the latter two are to be considered beta. You generally don't reference instances of this class directly, except when registering a custom provider.

An OAuthSettings instance contains application-specific settings, such as the client id, for use with a particular provider. Also it provides methods to obtain authorization using these settings. If authorization is successful, an OAuthSession instance is returned. For three-legged OAuth, use the userAuthUri method to obtain the URL where the user agent is to be redirected to. When the authorization code is received, through redirection back to the application, call userSession to obtain the OAuthSession.

An OAuthSession holds an access token and optionally a refresh token. Use its authorizeRequest method to apply the access token to an HTTPClientRequest. If the access token has expired, it will automatically be refreshed, if a refresh token is available.

Available versions

0.1.4 0.1.3 0.1.2 0.1.1 0.1.0 0.0.1-alpha ~master ~0.1