Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Vapor
  3. Imperial

Imperial

MITSwift2.2.0

A Vapor middleware for adding federated authentication with OAuth providers to Swift server applications.

Visit WebsiteGitHubGitHub
194 stars52 forks0 contributors

What is Imperial?

Imperial is a Swift package that provides federated authentication with OAuth providers for Vapor applications. It simplifies integrating external login services like GitHub by handling the OAuth flow, token storage, and route protection, allowing developers to offload user authentication to trusted third-party providers.

Target Audience

Swift developers building server-side applications with the Vapor framework who need to implement secure, federated user authentication without managing user credentials directly.

Value Proposition

Developers choose Imperial because it offers a Vapor-native, middleware-based solution that reduces the boilerplate and complexity of implementing OAuth, with built-in session management and route protection tailored for Swift server environments.

Overview

Federated Authentication with OAuth providers

Use Cases

Best For

  • Adding GitHub login to a Vapor web application
  • Protecting API routes in a Vapor server with OAuth-based authentication
  • Implementing federated authentication for a Swift backend service
  • Simplifying OAuth integration in Vapor projects with pre-built provider support
  • Managing user sessions and access tokens from external identity providers in Swift

Not Ideal For

  • Applications built with other server frameworks like Express.js or Django, as it is Vapor-specific.
  • Projects requiring stateless JWT authentication without server-side sessions, due to its reliance on Vapor's session middleware.
  • Teams needing built-in user profile management or database integration, as it focuses solely on OAuth flow and token handling.
  • Mobile or client-side apps where OAuth should be handled client-side, since it's designed for server-side Vapor backends.

Pros & Cons

Pros

Seamless Vapor Integration

Tailored for Vapor's ecosystem, using its sessions middleware and routing system, as shown in the README's configuration examples for easy setup.

Pre-Built OAuth Providers

Includes modules like ImperialGitHub for quick integration with external services, reducing boilerplate code for OAuth implementation.

Simple Route Protection

Offers ImperialMiddleware to guard routes with minimal code, ensuring only authenticated users access protected endpoints, as demonstrated in the grouped routes example.

Flexible Callback Handling

Allows custom logic or simple redirects in OAuth callbacks, giving developers control over post-authentication flows, as highlighted in the route registration options.

Cons

Vapor-Only Dependency

Exclusively tied to the Vapor framework, making it incompatible with other Swift server environments or non-Swift projects, limiting its portability.

Session-Based Limitations

Relies on Vapor's sessions for token storage, which may not suit stateless APIs or applications preferring JWT or other token-based approaches without server sessions.

Community-Maintained Risks

As a vapor-community project, it might have slower updates or less official support compared to core Vapor packages, potentially affecting long-term reliability.

Frequently Asked Questions

Quick Stats

Stars194
Forks52
Contributors0
Open Issues8
Last commit1 year ago
CreatedSince 2017

Tags

#hacktoberfest#oauth#authentication#swift-package-manager#swift4#vapor-3#federated-identity#vapor#spm#swift-server#swift#vapor-provider#middleware#session-management#api-security

Built With

S
Swift
V
Vapor

Links & Resources

Website

Included in

Vapor1.3k
Auto-fetched 1 hour ago

Related Projects

MongoKittenMongoKitten

Native MongoDB driver for Swift, written in Swift

Stars756
Forks113
Last commit5 months ago
SwifQLSwifQL

💎 A Swift DSL for type-safe, extensible, and transformable SQL queries.

Stars302
Forks19
Last commit2 days ago
Stripe ProviderStripe Provider

Stripe library for Vapor

Stars185
Forks30
Last commit3 years ago
Vapor Security HeadersVapor Security Headers

Harden Your Security Headers For Vapor

Stars153
Forks15
Last commit1 year ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub