rn-cljs-apple-authentication
is a library that adapts the React Native
bindings to Sign In With Apple
provided by @invertase/react-native-apple-authentication
to a more fluent Clojure idiom.
This is pre-release software that I am using as I develop an application that uses it, and will change frequently until release.
Add the following to your deps.edn
:
io.joshmiller/rn-cljs-apple-authentication {:git/url "https:github.com/joshuamiller/rn-cljs-apple-authentication"
:sha "current-sha"}
Install dependencies:
clj -m cljs.main --install-deps
Compile provided Cocoapods:
cd ios/
pod install
cd ..
In your application:
(ns my-app
(:require [io.joshmiller.rn-cljs-apple-authentication.ui :as auth-ui]
[io.joshmiller.rn-cljs-apple-authentication.core :as auth]))
,,,
[auth-ui/sign-in-with-apple-button
{:button-type (:default auth-ui/button-types)
:button-style (:default auth-ui/button-styles)
:on-press auth/basic-login}]
The basic-login
fn will return a core.async
channel that will
deliver either a user object or an error depending on the outcome of
the sign in process. Note that it will always return an error in the
simulator. You will likely want to adapt the code in basic-login
to fit your application's flow.