Giter Club home page Giter Club logo

capacitor-cloudkit's Introduction

capacitor-cloudkit

Basic CloudKit authentication plugin. v1 is Capacitor 4, v2 is Capacitor 5, v3 is Capacitor 6.

Install

npm install capacitor-cloudkit
npx cap sync

Setup

Each different platform requires a different ckAPIToken.

  • Web: Token configured for postMessage.
  • iOS: Token configured to redirect to your container's URL scheme. It'll show up on the CloudKit dashboard in a dropdown when you create an API key. Mine is cloudkit-icloud.baseline.getbaseline.app://, so I'll be using that as an example. I set mine to cloudkit-icloud.baseline.getbaseline.app://callback.
  • Android: Token configured to redirect to https://example.com or some similar existant but blank domain.

Setup (iOS)

  • Add your callback URL as a URL scheme in your app, in the Info tab. (e.g. cloudkit-icloud.baseline.getbaseline.app)
  • Add the following to the beginning of func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool in AppDelegate:
if (url.scheme == "PUT CALLBACK URL SCHEME HERE (e.g. cloudkit-icloud.baseline.getbaseline.app)") {
    NotificationCenter.default.post(name: NSNotification.Name("cloudkitLogin"), object: url);
}

API

authenticate(...)

authenticate(options: SignInOptions) => Promise<{ ckWebAuthToken: string; }>
Param Type
options SignInOptions

Returns: Promise<{ ckWebAuthToken: string; }>


fetchRecord(...)

fetchRecord(options: FetchRecordOptions) => Promise<any>

Only available on iOS.

Param Type
options FetchRecordOptions

Returns: Promise<any>


Interfaces

SignInOptions

Prop Type
containerIdentifier string
environment 'development' | 'production'
ckAPIToken string

FetchRecordOptions

Prop Type
containerIdentifier string
database 'private' | 'public' | 'shared'
by 'recordName'
recordName string

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.