@diadal/signin-with-apple
v0.1.6
Published
Sign In With Apple for Capacitor 3
Downloads
4
Readme
@diadal/signin-with-apple
Sign In With Apple for Capacitor 3
Install
npm install @diadal/signin-with-apple
npx cap sync
<template>
<div class="row items-center justify-evenly">
<button label="Test" @click="LoginApp()" />
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { uid } from 'quasar';
import {
SigninWithApple,
AppleSignResponse,
AppleSignOptions,
} from '@diadal/signin-with-apple';
export default defineComponent({
name: 'PageIndex',
setup() {
const options: AppleSignOptions = {
clientId: 'app.example',
redirectURI: 'https://example.com/auth/apple/callback',
scopes: 'email name',
state: '********',
nonce: '**********',
};
function LoginApp() {
SigninWithApple.authorize(options)
.then((result: AppleSignResponse) => {
console.log('result111', result);
})
// eslint-disable-next-line @typescript-eslint/no-explicit-any
.catch((error: any) => {
console.log('error111', error);
});
}
return { LoginApp };
},
});
</script>
API
authorize(...)
authorize(options?: AppleSignOptions | undefined) => Promise<AppleSignResponse>
| Param | Type |
| ------------- | ------------------------------------------------------------- |
| options
| AppleSignOptions |
Returns: Promise<AppleSignResponse>
Interfaces
AppleSignResponse
| Prop | Type |
| -------------- | -------------------------------------------------------------------------------------------------------------- |
| response
| { user: string[]; email: string | null; state: string | null; id_token: string; code: string; } |
AppleSignOptions
| Prop | Type |
| ----------------- | ------------------- |
| clientId
| string |
| redirectURI
| string |
| scopes
| string |
| state
| string |
| nonce
| string |