Swiftpack.co -  d-date/OAuth2Client as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
d-date/OAuth2Client
Lightweight OAuth 2.0 Client with PKCE (Proof key for Code Exchange: see [RFC 7636](https://tools.ietf.org/html/rfc7636))
.package(url: "https://github.com/d-date/OAuth2Client.git", from: "0.2.0")

MIT License

OAuth2Client

Lightweight OAuth 2.0 Client with PKCE (Proof key for Code Exchange: see RFC 7636)

Usage

Sign in

OAuth2Client().signIn(request: request) 
  .receive(on: yourQueue)
  .sink(receiveCompletion: { (completion) in
    
  }, receiveValue: { (credential) in
    credential.save()
  })

Load Access Token

Credential.load()

Refresh

OAuth2Client().refresh(request: request) 
.receive(on: yourQueue)
.sink(receiveCompletion: { (completion) in

}, receiveValue: { (credential) in
credential.save()
})

Sign Out

Removing cache on WebKit, and showing new auth screen.

OAuth2Client().signOut(request: request) 
  .receive(on: yourQueue)
  .sink(receiveCompletion: { (completion) in

  }, receiveValue: { (credential) in
    credential.save()
  })

Features

  • ☑ Supporting OAuth 2.0 with PKCE
  • ☑ Publish / refresh access token
  • ☑ Combine interface

General notes for OAuth 2.0

  • Make sure setting callback url scheme on your setting

Supported platforms

  • macOS v11.0 and later
  • iOS / iPadOS v14.0 and later

Installation

Only support via Swift package manager installation.

Swift Package Manager

dependencies: [
  .package(url: "https://github.com/d-date/OAuth2Client.git", from: "0.1.0")
]

GitHub

link
Stars: 12
Last commit: 6 days ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

26 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API