Swiftpack.co - Package - brokenhandsio/vapor-oauth-fluent

Vapor OAuth Fluent

Vapor OAuth Fluent

Language Build Status Code Coverage MIT License

This repo contains a Fluent implementations for the required protocols for Vapor OAuth.


Vapor OAuth can Fluent be added to your Vapor add with a simple provider. To get started, first add the library to your Package.swift dependencies:

dependencies: [
    .package(url: "https://github.com/brokenhandsio/vapor-oauth-fluent", .upToNextMajor(from: "0.4.0"))

Next import the library into where you set up your Droplet:

import VaporOAuthFluent

Then choose the implementations you wish to add the provider you add in your Config. For example:

try addProvider(VaporOAuth.Provider(codeManager: FluentCodeManager(), tokenManager: FluentTokenManager(), clientRetriever: FluentClientRetriever(), authorizeHandler: MyAuthHandler(), userManager: FluentUserManager(), validScopes: ["view_profile", "edit_profile"], resourceServerRetriever: FluentResourceServerRetriever()))

You can choose which implementations to use, or write your custom ones. For instance you may choose to use Fluent for Tokens and Users, but hard code the clients and use JWT to manage Codes.

Models Included

The following models have Fluent extensions included with this repository:

  • AccessToken
  • RefreshToken
  • OAuthCode
  • OAuthUser
  • OAuthClient
  • OAuthResourceServer

Note you will need to add these models to your preparations if you wish to use any of these.

Managers Included

As well as models, Vapor OAuth Fluent includes implementations for the Managers required to interact with the models. The included managers are:

  • FluentClientRetriever
  • FluentCodeManager
  • FluentTokenManager
  • FluentUserManager
  • FluentResourceServerRetriever


Stars: 12
Help us keep the lights on


0.4.0 - Sep 27, 2017

Vapor OAuth Fluent 0.4.0

  • PR #4 - add support for Swift 4
  • PR #5 - add default implementations for the resource server implementation

0.3.0 - Aug 5, 2017

Vapor OAuth Fluent 0.3.0

This release brings in the latest changes required by Vapor OAuth as well as some code tidy ups to make swiftlint happy

0.2.0 - Aug 3, 2017

Vapor OAuth Fluent 0.2.0

This release improves the integration of Fluent with Vapor OAuth by moving from subclasses to extensions. This means less duplicated code and easier to understand!

0.1.1 - Aug 2, 2017

Vapor OAuth Fluent 0.1.1

This release separates the Client ID from the database ID to make it easier to insert good client IDs into the database

0.1.0 - Jul 26, 2017

Vapor OAuth Fluent 0.1.0

The initial release! Things are likely to change a fair bit, so keep an eye on the releases. For now, check out the README