https://github.com/lukeredpath/oauth-pkce-ios-client
A small example of how to use OAuth in a SwiftUI app with PKCE
https://github.com/lukeredpath/oauth-pkce-ios-client
Last synced: 10 months ago
JSON representation
A small example of how to use OAuth in a SwiftUI app with PKCE
- Host: GitHub
- URL: https://github.com/lukeredpath/oauth-pkce-ios-client
- Owner: lukeredpath
- License: mit
- Created: 2020-07-16T15:37:10.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2025-01-29T18:27:49.000Z (over 1 year ago)
- Last Synced: 2025-07-25T11:30:00.924Z (11 months ago)
- Language: Swift
- Size: 16.6 KB
- Stars: 15
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# iOS OAuth with PKCE example client
This is a very small SwiftUI app that demonstrates how to authenticate using OAuth using the authorization code grant with PKCE.
It is designed to work with the [proof-of-concept PKCE proxy server](https://github.com/lukeredpath/oauth-pkce-proxy).
The example app does not use any third-party libraries. It:
* Uses `ASWebAuthenticationSession` from the `AuthenticationServices` framework to allow the user to authenticate with a third-party service via the PKCE proxy and obtain the authorization grant code.
* Uses `CryptoKit` to generate the PKCE code challenge.
* Makes a simple POST request using `URLSession` to exchange the authentication code for an access token, again via the PKCE proxy.
This is not production-ready code and is simply a proof of concept.