项目作者: d-date

项目描述 :
Lightweight OAuth 2.0 Client with PKCE (Proof key for Code Exchange: see [RFC 7636](https://tools.ietf.org/html/rfc7636))
高级语言: Swift
项目地址: git://github.com/d-date/OAuth2Client.git
创建时间: 2021-01-20T05:07:14Z
项目社区:https://github.com/d-date/OAuth2Client

开源协议:MIT License

下载



MIT License

OAuth2Client

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

Usage

Sign in

  1. OAuth2Client().signIn(request: request)
  2. .receive(on: yourQueue)
  3. .sink(receiveCompletion: { (completion) in
  4. }, receiveValue: { (credential) in
  5. credential.save()
  6. })

Load Access Token

  1. Credential.load()

Refresh

  1. OAuth2Client().refresh(request: request)
  2. .receive(on: yourQueue)
  3. .sink(receiveCompletion: { (completion) in
  4. }, receiveValue: { (credential) in
  5. credential.save()
  6. })

Sign Out

Removing cache on WebKit, and showing new auth screen.

  1. OAuth2Client().signOut(request: request)
  2. .receive(on: yourQueue)
  3. .sink(receiveCompletion: { (completion) in
  4. }, receiveValue: { (credential) in
  5. credential.save()
  6. })

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

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