https://github.com/d-date/oauth2client
Lightweight OAuth 2.0 Client with PKCE (Proof key for Code Exchange: see [RFC 7636](https://tools.ietf.org/html/rfc7636))
https://github.com/d-date/oauth2client
ios macos oauth2-client pkce pkce-flow swift
Last synced: 3 months ago
JSON representation
Lightweight OAuth 2.0 Client with PKCE (Proof key for Code Exchange: see [RFC 7636](https://tools.ietf.org/html/rfc7636))
- Host: GitHub
- URL: https://github.com/d-date/oauth2client
- Owner: d-date
- License: mit
- Created: 2021-01-20T05:07:14.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-09-07T10:00:11.000Z (about 4 years ago)
- Last Synced: 2025-04-10T03:17:17.628Z (6 months ago)
- Topics: ios, macos, oauth2-client, pkce, pkce-flow, swift
- Language: Swift
- Homepage:
- Size: 15.6 KB
- Stars: 12
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OAuth2Client
Lightweight OAuth 2.0 Client with PKCE (Proof key for Code Exchange: see [RFC 7636](https://tools.ietf.org/html/rfc7636))
## Usage
### Sign in
```swift
OAuth2Client().signIn(request: request)
.receive(on: yourQueue)
.sink(receiveCompletion: { (completion) in
}, receiveValue: { (credential) in
credential.save()
})
```### Load Access Token
```swift
Credential.load()
```### Refresh
```swift
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.```swift
OAuth2Client().signOut(request: request)
.receive(on: yourQueue)
.sink(receiveCompletion: { (completion) in}, receiveValue: { (credential) in
credential.save()
})
```## Features
- [x] Supporting OAuth 2.0 with PKCE
- [x] Publish / refresh access token
- [x] 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
```swift
dependencies: [
.package(url: "https://github.com/d-date/OAuth2Client.git", from: "0.1.0")
]
```