OIDCLite implements the basics of getting a token using Apple's ASWebAuthenticationSession

Related tags

Database OIDCLite
Overview

OIDCLite

While there are a few good Swift packages for Open ID Connect out there, most are /very/ heavyweight and can get quite complex. For projects that have rather modest needs of just confirming a user is valid, and perhaps acquring an OIDC token set for a subsequent operation, OIDCLite may be what you're looking for!

OIDCLite implements the basics of getting a token using Apple's ASWebAuthenticationSession so you have very little web things to deal with. OIDCLite fully supports PKCE and client secrets (if you must).

ASWebAuthenticationSession works REALLY well on iOS and should easily handle all of your needs. It blends in with your iOS app and it looks well put together. On the Mac... it's a bit of a different story, so try it out a few times.

OIDCLite will take a discovery URL, parse out the correct endpoints and provide you a URL to feed into ASWebAuthenticationSession. On a successful auth, you can pass the resultant code back into OIDCLite and have it get you a set of tokens.

OIDCLite fully supports PKCE (Proof Key for Code Exchange) in addition to client secrets.

By default OIDCLite will use oidclite://OpenID as the callback URI and "openid", "profile", "email", "offline_access" as the default scopes. You are, of course, free to change these to whatever you want.

This package supports macOS 10.15 and greater and iOS 14 and greater. It could probably work for older versions of macOS but you'd have to bail on CryptoKit and bring in CommonCrypto.

At some point WKNavigationDelegate support will be added to this so that you can use this package with WKWebViews in addition to ASWebAuthenticationSession. Although if you want to do that today... you can do the delegate yourself and pass the resultant code back into OIDCLite for processing.


Usage:

Create a new OIDCLite object

let oidcLite = OIDCLite(discoveryURL: "https://oidc.example.com/.well-known/openid-configuration", clientID: "clientid", clientSecret: nil, redirectURI: "yourURI://oidc", scopes: nil)

Get the endpoints associated with the OIDC app

oidcLite.getEndpoints()

Once an ASWebAuthenticationSession has been created, you can process the redirect URI

do { try oidcLite.processResponseURL(url: url) } catch { // Handle the error here print(error) }

A more detailed example can be found in the Examples folder.


Notes:

  • There's no support for any token lifecycle management here, this package is specifically to get a new token for authentication/identity purposes.

  • There's no need to enable PKCE, as it's used with every operation regardless.

  • Currently only a code grant flow is supported. For the purposes of authenticating an app this is the most preferred flow to use.

  • This package has been succesfully tested with Okta, Azure, OneLogin and ORY Hydra OIDC servers. Confidence is high that this will work with any OIDC compliant service.

You might also like...
Ios-App-ication-Swift - A simple iOS application made in Xcode using Swift
Ios-App-ication-Swift - A simple iOS application made in Xcode using Swift

📱 iPhone Calculator A simple iOS application made in Xcode using Swift. This ap

A proof-of-concept WebURL domain renderer, using a port of Chromium's IDN spoof-checking logic to protect against confusable domains

WebURLSpoofChecking A proof-of-concept WebURL.Domain renderer which uses a port of Chromium's IDN spoof-checking logic (Overview, Implementation) to p

A practical interface to the Steamworks SDK using the Swift C++ importer

steamworks-swift A practical interface to the Steamworks SDK using the Swift C++ importer. Caveat Integrator: The Swift C++ importer is a chaotic scie

Aplicación SwiftUI para visualizar datos de Github dados un usuario y un token (Github token), implementa autenticación biométrica mediante FaceID.
Aplicación SwiftUI para visualizar datos de Github dados un usuario y un token (Github token), implementa autenticación biométrica mediante FaceID.

ios-app-swift-gitapp Aplicación SwiftUI para visualizar datos de Github dados un usuario y un token (Github token), implementa autenticación biométric

🐵Fooling around with Apples private framework AvatarKit
🐵Fooling around with Apples private framework AvatarKit

Fooling around with Apples private framework AvatarKit, the framework used in Messages.app for recording Animoji videos. If you are looking to create your own Animoji, take a look at SBSCustomAnimoji.

A better way to present a SFSafariViewController or start a ASWebAuthenticationSession in SwiftUI.
A better way to present a SFSafariViewController or start a ASWebAuthenticationSession in SwiftUI.

BetterSafariView A better way to present a SFSafariViewController or start a ASWebAuthenticationSession in SwiftUI. Contents Motivation Requirements U

A better way to present a SFSafariViewController or start a ASWebAuthenticationSession in SwiftUI
A better way to present a SFSafariViewController or start a ASWebAuthenticationSession in SwiftUI

A better way to present a SFSafariViewController or start a ASWebAuthenticationSession in SwiftUI.

In this mini app covered the concepts like basics of SwiftUI and Navigations and Animations and List with CRUD functions and MVVM and App Launch and App icons adding and also applied persistence using UserDefaults Concept.
In this mini app covered the concepts like basics of SwiftUI and Navigations and Animations and List with CRUD functions and MVVM and App Launch and App icons adding and also applied persistence using UserDefaults Concept.

TodoList In this application used the concepts from the beginner level project of SwiftUI_Evolve_1 The following concepts covered in this mini app Swi

LinkedInSignIn - Simple view controller to log in and retrieve an access token from LinkedIn.
LinkedInSignIn - Simple view controller to log in and retrieve an access token from LinkedIn.

LinkedInSignIn Example To run the example project, clone the repo, and run pod install from the Example directory first. Also you need to setup app on

A token field implementation for iOS

ResizingTokenField A token field implementation written in Swift 5. Features Can be used in Interface Builder or created programmatically Uses a UICol

Just For Fun - tiny easy apps, refresher for swift basics

Stanford Swift Education - Very Basic - Refresher Some useful hints: Outlet types: Outlet Action Outlet Collection with Index - very useful Debugger l

Highly customizable iOS tags view [input, edit, dynamic, tag, token, field, NSTokenField]
Highly customizable iOS tags view [input, edit, dynamic, tag, token, field, NSTokenField]

RKTagsView Highly customizable iOS tags view (like NSTokenField). Supports horizontal and vertical direction, editing, multiple selection, Auto Layout

Easy-to-use token field that is used in the Venmo app.
Easy-to-use token field that is used in the Venmo app.

VENTokenField VENTokenField is the recipients token field that is used in the Venmo compose screen. Installation The easiest way to get started is to

A sample project that provides the basics to create an interactive VR experience on iOS
A sample project that provides the basics to create an interactive VR experience on iOS

VR_Toolkit_iOS A sample project that provides a basic toolkit to create an interactive VR experience on iOS. Written in Swift 2.0 using SceneKit. We a

Swift Programming Basics - Collections, Variables & Constants

Dicee What I learned in this module How to clone an existing Xcode project from GitHub. Create an app with behaviour and functionality. Create links b

Swift playground teaching basics of buffer overflow vulnerability and ARM64 assembly by exploiting vulnerable app on ARM64 emulator (WWDC22 Swift Student Challenge Winner)
Swift playground teaching basics of buffer overflow vulnerability and ARM64 assembly by exploiting vulnerable app on ARM64 emulator (WWDC22 Swift Student Challenge Winner)

Pwnground Project overview Pwnground is a project created as my submission for WWDC22 Swift Student Challenge (winner). It is an interactive Swift Pla

React Native utility library around image and video files for getting metadata like MIME type, timestamp, duration, and dimensions. Works on iOS and Android using Java and Obj-C, instead of Node 🚀.

Qeepsake React Native File Utils Extracts information from image and video files including MIME type, duration (video), dimensions, and timestamp. The

A simple Pokedex app written in Swift that implements the PokeAPI, using Combine and data driven UI.
A simple Pokedex app written in Swift that implements the PokeAPI, using Combine and data driven UI.

SwiftPokedex SwiftPokedex is a simple Pokedex app written by Viktor Gidlöf in Swift that implements the PokeAPI. For full documentation and implementa

React Native library that implements PayPal Checkout flow using purely native code (swift).
React Native library that implements PayPal Checkout flow using purely native code (swift).

react-native-paypal-swift React Native library that implements PayPal Checkout flow using purely native code (swift). Installation npm install react-n

Comments
  • Support login_hint for createLoginURL

    Support login_hint for createLoginURL

    OIDC login URL can have a login_hint param. ref: https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest

    If you already know the login ID, it improves the UX.

    opened by kenchan0130 3
Owner
Joel Rennich
Joel Rennich
Shows the issue with swift using an ObjC class which has a property from a swift package.

SwiftObjCSwiftTest Shows the issue with swift using an ObjC class which has a property from a swift package. The Swift class (created as @objc derived

Scott Little 0 Nov 8, 2021
iForage helps foragers to track and manage foraging spots around them using CloudKit

iForage CloudKit Preface To expand on what I've created here: https://github.com/LynchConnor/iForage, I initially developed the app using Firebase. Th

Connor Lynch 3 Jul 14, 2022
A food delivery app using firebase as the database.

FDA-ONE Food Delivery Application is a mobile application that users can use to find the best restaurant around their location and order the meals the

Naseem Oyebola 0 Nov 28, 2021
Implement Student Admission System using SQlite

StudentAdmissionSQLiteApp Implement Student Admission System using SQlite. #Func

Hardik 2 Apr 27, 2022
Creating a Todo app using Realm and SwiftUI

Realmで作るTodoアプリ note記事「【SwiftUI】Realmを使ってTodoアプリを作る」のソースです。

null 1 Jul 20, 2022
Innova CatchKennyGame - The Image Tap Fun Game with keep your scores using Core Database

Innova_CatchKennyGame The Image Tap Fun Game with keep your scores using Core Da

Alican Kurt 0 Dec 31, 2021
CRRateLimitTester - Simple Clash Royale Rate Limit Tester Written Using HummingBird and Swift

CRRateLimitTester Simple Clash Royale Rate Limit Tester Written Using HummingBir

Mahdi Bahrami 0 Jan 16, 2022
CleanArchitecture - Helping project to learn Clean Architecture using iOS (Swift)

Clean Architecture Helping project to learn Clean Architecture using iOS (Swift)

Alliston 2 Dec 5, 2022
BowTies - The main purpose of this application is to show how you can perform simple operations using Core Data

BowTies The main purpose of this application is to show how you can perform simp

slemeshaev 1 Jan 31, 2022
CloudKit, Apple’s remote data storage service, provides a possibility to store app data using users’ iCloud accounts as a back-end storage service.

CloudKit, Apple’s remote data storage service, provides a possibility to store app data using users’ iCloud accounts as a back-end storage service. He

Yalantis 252 Nov 4, 2022