{"repo":"vapor-community/Imperial","free":true,"listed":false,"github":"https://github.com/vapor-community/Imperial","clone":"git clone https://github.com/vapor-community/Imperial.git","description":"Federated Authentication with OAuth providers","language":"Swift","stars":194,"topics":["federated-identity","federated-social-web","oauth","vapor","swift","swift4","imperial","vapor-provider","vapor-3","swift-package-manager"],"license":"MIT","category":"auth-billing-email","readme_excerpt":"Imperial 🔐 Federated Authentication with OAuth providers for Vapor. Installation Use the SPM string to easily include the dependendency in your Package.swift file and then add the desired provider to your target's dependencies: Overview Imperial is a Federated Login service, allowing you to easily integrate your Vapor applications with OAuth providers to handle your apps authentication. Getting Started Sessions Middleware Imperial relies on the sessions middleware to save state and access tokens. In configure.swift , or as a route group for specific routes, add the sessions middleware. For example, to add it globally: Route Registration Imperial uses environment variables to access the client ID and secret to authenticate with the provider. See the provider specific docs for details on what they should be. You need to register the OAuth service with your route. For example, to register a GitHub integration add the following: This registers a route to /github . When you visit that route, Imperial will trigger the OAuth flow using the GitHub service. The callback path is the one registered with the OAuth provider when you create your application. The completion handler is fired when the callback route is called by the OAuth provider. The access token is passed in and a response is returned. If you just want to redirect, without doing anything else in the callback, you can use the helper RoutesBuilder/oAuth(from:authenticate:authenticateCallback:callback:scope:redirect:) method","default_branch":null,"files":null,"tree":[],"storefront":"/r/vapor-community","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/vapor-community/Imperial/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}