FCLAuthSwift is a Swift library for the Flow Client Library (FCL) that enables Flow wallet authentication on iOS devices.

Overview

FCLAuthSwift

FCLAuthSwift is a Swift library for the Flow Client Library (FCL) that enables Flow wallet authentication on iOS devices.

Demo

The demo app in this project shows how to use FCL inside an iOS app.

Installation

dependencies: [
  .package(url: "https://github.com/zed-io/fcl-auth-swift.git", from: "0.0.5-beta")
]

Configuration

You will need to configure your app information before using the authentication library.

FCLAuthSwift ships with several built-in wallet providers (Dapper, Blocto), but you can also define custom wallet providers if needed.

import FCLAuthSwift

// optional: define a custom wallet provider
let provider = FCLWalletProvider(
    id: "foo",
    name: "bar",
    method: .httpPost,
    endpoint: URL(string: "https://foo.com/api/")!
)
        
fcl.config(
    appInfo: FCLAppInfo(
        title: "FCL iOS Demo",
        icon: URL(string: "https://foo.com/bar.png")!
    ),
    // default providers are [.dapper, .blocto]
    providers: [.dapper, .blocto, .custom(provider)]
)

Authenticate

fcl.authenticate(provider: .dapper) { result in
    switch result {
    case let .success(data):
        print(data.address)
    case let .failure(error):
        print(error)
    }
}

The data variable is of type FCLAuthnResponse, which contains the user's wallet address:

public struct FCLAuthnResponse {
    public let address: String
}

Delegate

The authentication library has an optional delegate to handle custom events or settings.

fcl.delegate = self

public protocol FCLAuthDelegate {
    // Show loading while waiting for network response
    func showLoading()
    // Hide loading when API call is completed 
    func hideLoading()
}

extension FCLAuthDelegate {
    // Configure which place to show authentication webview
    // The default value is ASPresentationAnchor()
    func presentationAnchor() -> UIWindow {
        return ASPresentationAnchor()
    }
}
You might also like...
Simple OAuth2 library with a support of multiple services.

Simple OAuth2 library with a support of multiple services.

OAuth2 framework for macOS and iOS, written in Swift.
OAuth2 framework for macOS and iOS, written in Swift.

OAuth2 OAuth2 frameworks for macOS, iOS and tvOS written in Swift 5.0. โคต๏ธ Installation ๐Ÿ›  Usage ๐Ÿ–ฅ Sample macOS app (with data loader examples) ๐Ÿ“– Tec

InstagramLogin allows iOS developers to authenticate users by their Instagram accounts.
InstagramLogin allows iOS developers to authenticate users by their Instagram accounts.

InstagramLogin handles all the Instagram authentication process by showing a custom UIViewController with the login page and returning an access token that can be used to request data from Instagram.

SimpleAuth is designed to do the hard work of social account login on iOS

SimpleAuth is designed to do the hard work of social account login on iOS. It has a small set of public APIs backed by a set of "providers"

A simple way to implement Facebook and Google login in your iOS apps.

Simplicity Simplicity is a simple way to implement Facebook and Google login in your iOS apps. Simplicity can be easily extended to support other exte

Krypton turns your iOS device into a WebAuthn/U2F Authenticator: strong, unphishable 2FA.

Krypton turns your iOS device into a WebAuthn/U2F Authenticator: strong, unphishable 2FA. Krypton implements the standardized FIDO Universal 2nd Facto

SpotifyLogin is a Swift 5 Framework for authenticating with the Spotify API.
SpotifyLogin is a Swift 5 Framework for authenticating with the Spotify API.

SpotifyLogin SpotifyLogin is a Swift 5 Framework for authenticating with the Spotify API. Usage of this framework is bound under the Developer Terms o

A swift implementation of OAuth2

#AlamofireOauth2 A Swift implementation of OAuth2 for iOS using Alamofire. #Intro This library is heavilly inspired by the SwiftOAuth2 repository from

Declarative Swift framework for Attributed Role-based Access Control management
Declarative Swift framework for Attributed Role-based Access Control management

Koosa Declarative Swift framework for Attributed Role-based Access Control management Check out this blog post for full explanation and more details:

Comments
  • Refactor FCL models

    Refactor FCL models

    This PR refactors the core FCL models to match the specification here: https://github.com/onflow/fcl-js/blob/master/packages/fcl/src/wallet-provider-spec/draft-v3.md

    Most of the renamed models are just Flow -> FCL

    I also fixed a small bug -- the provider URL was still being hardcoded rather than being fetched from the provider.

    opened by psiemens 0
Releases(v0.0.1-beta)
Owner
Zed
A mobile, blockchain software development company
Zed
A simple project for Face ID Authentication for iOS device using LocalAuthentication Framework

BiometricAuthentication This respository is a simple project for Face ID Authentication for iOS device using LocalAuthentication Framework and infoPli

Lee McCormick 0 Oct 23, 2021
A UIViewController subclass for Instagram authentication.

InstagramAuthViewController A ViewController for Instagram authentication. A UIViewController subclass that handles showing the Instagram login page,

Isuru Nanayakkara 38 Jun 29, 2021
Implementing User Authentication with Sign in with Apple

Implementing User Authentication with Sign in with Apple Provide a way for users of your app to set up an account and start using your services. Overv

null 0 Oct 18, 2021
Implementing User Authentication with Sign in with Apple

Implementing User Authentication with Sign in with Apple Provide a way for users of your app to set up an account and start using your services. Overv

Liselot 0 Dec 2, 2021
Easy to use OAuth 2 library for iOS, written in Swift.

Heimdallr Heimdallr is an OAuth 2.0 client specifically designed for easy usage. It currently supports the resource owner password credentials grant f

trivago N.V. 628 Oct 17, 2022
Swift based OAuth library for iOS

OAuthSwift Swift based OAuth library for iOS and macOS. Support OAuth1.0, OAuth2.0 Twitter, Flickr, Github, Instagram, Foursquare, Fitbit, Withings, L

OAuthSwift 3.1k Jan 3, 2023
Swift based OAuth library for iOS and macOS

OAuthSwift Swift based OAuth library for iOS and macOS. Support OAuth1.0, OAuth2.0 Twitter, Flickr, Github, Instagram, Foursquare, Fitbit, Withings, L

OAuthSwift 3.1k Jan 3, 2023
A simple OAuth library for iOS with a built-in set of providers

SwiftyOAuth is a small OAuth library with a built-in set of providers and a nice API to add your owns. let instagram: Provider = .instagram(clientID:

Damien 477 Oct 15, 2022
A simple library to make authenticating tvOS apps easy via their iOS counterparts.

Voucher The new Apple TV is amazing but the keyboard input leaves a lot to be desired. Instead of making your users type credentials into their TV, yo

Riz 516 Nov 24, 2022
Swift async/await OAuth 2.0 HTTP request library.

SwAuth SwAuth is an OAuth 2.0 HTTP request library written in Swift iOS 15.0+, macOS 12.0+, watchOS 8.0+, and tvOS 15.0+. Features Requirements Instal

Colaski 17 Nov 5, 2022