0.0.38 • Published 10 months ago

@kim5257/capacitor-google-authentication v0.0.38

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@kim5257/capacitor-google-authentication

Google Authentication Capacitor Plugin

Install

npm install @kim5257/capacitor-google-authentication
npx cap sync

API

initialize(...)

initialize(config: GoogleAuthenticationOptions) => Promise<{ result: 'success' | 'error'; }>
ParamType
configGoogleAuthenticationOptions

Returns: Promise<{ result: 'error' | 'success'; }>


verifyPhoneNumber(...)

verifyPhoneNumber(options: { phone: string; elem?: HTMLElement; }) => Promise<{ result: 'success' | 'error'; }>
ParamType
options{ phone: string; elem?: any; }

Returns: Promise<{ result: 'error' | 'success'; }>


confirmPhoneNumber(...)

confirmPhoneNumber(options: { code: string; }) => Promise<{ result: 'success' | 'error'; }>
ParamType
options{ code: string; }

Returns: Promise<{ result: 'error' | 'success'; }>


createUserWithEmailAndPassword(...)

createUserWithEmailAndPassword(options: { email: string; password: string; }) => Promise<{ result: "success" | "error"; idToken: string; }>
ParamType
options{ email: string; password: string; }

Returns: Promise<{ result: 'error' | 'success'; idToken: string; }>


signInWithEmailAndPassword(...)

signInWithEmailAndPassword(options: { email: string; password: string; }) => Promise<{ result: "success" | "error"; idToken: string; }>
ParamType
options{ email: string; password: string; }

Returns: Promise<{ result: 'error' | 'success'; idToken: string; }>


signInWithGoogle()

signInWithGoogle() => Promise<{ result: "success" | "error"; idToken: string; }>

Returns: Promise<{ result: 'error' | 'success'; idToken: string; }>


signInWithCustomToken(...)

signInWithCustomToken({ customToken }: { customToken: string; }) => Promise<{ result: "success" | "error"; idToken: string; }>
ParamType
__0{ customToken: string; }

Returns: Promise<{ result: 'error' | 'success'; idToken: string; }>


signInWithApple()

signInWithApple() => Promise<{ result: "success" | "error"; idToken: string; }>

Returns: Promise<{ result: 'error' | 'success'; idToken: string; }>


getIdToken(...)

getIdToken(options: { forceRefresh: boolean; }) => Promise<{ result: 'success' | 'error'; idToken: string; }>
ParamType
options{ forceRefresh: boolean; }

Returns: Promise<{ result: 'error' | 'success'; idToken: string; }>


getCurrentUser()

getCurrentUser() => Promise<{ result: 'success' | 'error'; user: User | null | undefined; }>

Returns: Promise<{ result: 'error' | 'success'; user: User | null; }>


updateProfile(...)

updateProfile(options: { displayName?: string; photoUri?: string; }) => Promise<{ result: 'success' | 'error'; }>
ParamType
options{ displayName?: string; photoUri?: string; }

Returns: Promise<{ result: 'error' | 'success'; }>


updateEmail(...)

updateEmail(options: { email: string; }) => Promise<{ result: 'success' | 'error'; }>
ParamType
options{ email: string; }

Returns: Promise<{ result: 'error' | 'success'; }>


signOut()

signOut() => Promise<{ result: 'success' | 'error'; }>

Returns: Promise<{ result: 'error' | 'success'; }>


linkWithPhone(...)

linkWithPhone({ phone, elem }: { phone: string; elem: HTMLElement; }) => Promise<{ result: "success" | "error"; }>
ParamType
__0{ phone: string; elem: any; }

Returns: Promise<{ result: 'error' | 'success'; }>


confirmLinkPhoneNumber(...)

confirmLinkPhoneNumber(options: { code: string; }) => Promise<{ result: 'success' | 'error'; }>
ParamType
options{ code: string; }

Returns: Promise<{ result: 'error' | 'success'; }>


updatePhoneNumber(...)

updatePhoneNumber({ phone, elem }: { phone: string; elem: HTMLElement; }) => Promise<{ result: "success" | "error"; }>
ParamType
__0{ phone: string; elem: any; }

Returns: Promise<{ result: 'error' | 'success'; }>


confirmUpdatePhoneNumber(...)

confirmUpdatePhoneNumber(options: { code: string; }) => Promise<{ result: 'success' | 'error'; }>
ParamType
options{ code: string; }

Returns: Promise<{ result: 'error' | 'success'; }>


echo(...)

echo(options: { value: string; }) => Promise<{ value: string; }>
ParamType
options{ value: string; }

Returns: Promise<{ value: string; }>


addListener('google.auth.phone.verify.completed', ...)

addListener(eventName: 'google.auth.phone.verify.completed', listenerFunc: (resp: { idToken: string; }) => void) => Promise<PluginListenerHandle>
ParamType
eventName'google.auth.phone.verify.completed'
listenerFunc(resp: { idToken: string; }) => void

Returns: Promise<PluginListenerHandle>


addListener('google.auth.phone.code.sent', ...)

addListener(eventName: 'google.auth.phone.code.sent', listenerFunc: (resp: { verificationId: string | null; resendingToken: string | null; }) => void) => Promise<PluginListenerHandle>
ParamType
eventName'google.auth.phone.code.sent'
listenerFunc(resp: { verificationId: string | null; resendingToken: string | null; }) => void

Returns: Promise<PluginListenerHandle>


addListener('google.auth.phone.verify.failed', ...)

addListener(eventName: 'google.auth.phone.verify.failed', listenerFunc: (resp: { message: string; }) => void) => Promise<PluginListenerHandle>
ParamType
eventName'google.auth.phone.verify.failed'
listenerFunc(resp: { message: string; }) => void

Returns: Promise<PluginListenerHandle>


addListener('google.auth.state.update', ...)

addListener(eventName: 'google.auth.state.update', listenerFunc: (resp: { idToken: string; }) => void) => Promise<PluginListenerHandle>
ParamType
eventName'google.auth.state.update'
listenerFunc(resp: { idToken: string; }) => void

Returns: Promise<PluginListenerHandle>


Interfaces

GoogleAuthenticationOptions

PropType
googleClientIdstring
persistence'SESSION' | 'LOCAL' | 'MEMORY'

User

A user account.

PropTypeDescription
emailVerifiedbooleanWhether the email has been verified with {@link sendEmailVerification} and {@link applyActionCode}.
isAnonymousbooleanWhether the user is authenticated using the {@link ProviderId}.ANONYMOUS provider.
metadataUserMetadataAdditional metadata around user creation and sign-in times.
providerDataUserInfo[]Additional per provider such as displayName and profile information.
refreshTokenstringRefresh token used to reauthenticate the user. Avoid using this directly and prefer {@link User.getIdToken} to refresh the ID token instead.
tenantIdstring | nullThe user's tenant ID.
MethodSignatureDescription
delete() => Promise<void>Deletes and signs out the user.
getIdToken(forceRefresh?: boolean | undefined) => Promise<string>Returns a JSON Web Token (JWT) used to identify the user to a Firebase service.
getIdTokenResult(forceRefresh?: boolean | undefined) => Promise<IdTokenResult>Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service.
reload() => Promise<void>Refreshes the user, if signed in.
toJSON() => objectReturns a JSON-serializable representation of this object.

IdTokenResult

Interface representing ID token result obtained from {@link User.getIdTokenResult}.

PropTypeDescription
authTimestringThe authentication time formatted as a UTC string.
expirationTimestringThe ID token expiration time formatted as a UTC string.
issuedAtTimestringThe ID token issuance time formatted as a UTC string.
signInProviderstring | nullThe sign-in provider through which the ID token was obtained (anonymous, custom, phone, password, etc).
signInSecondFactorstring | nullThe type of second factor associated with this session, provided the user was multi-factor authenticated (eg. phone, etc).
tokenstringThe Firebase Auth ID token JWT string.
claimsParsedTokenThe entire payload claims of the ID token including the standard reserved claims as well as the custom claims.

ParsedToken

Interface representing a parsed ID token.

PropTypeDescription
'exp'stringExpiration time of the token.
'sub'stringUID of the user.
'auth_time'stringTime at which authentication was performed.
'iat'stringIssuance time of the token.
'firebase'{ sign_in_provider?: string; sign_in_second_factor?: string; identities?: Record<string, string>; }Firebase specific claims, containing the provider(s) used to authenticate the user.

UserMetadata

Interface representing a user's metadata.

PropTypeDescription
creationTimestringTime the user was created.
lastSignInTimestringTime the user last signed in.

UserInfo

User profile information, visible only to the Firebase project's apps.

PropTypeDescription
displayNamestring | nullThe display name of the user.
emailstring | nullThe email of the user.
phoneNumberstring | nullThe phone number normalized based on the E.164 standard (e.g. +16505550101) for the user.
photoURLstring | nullThe profile photo URL of the user.
providerIdstringThe provider used to authenticate the user.
uidstringThe user's unique ID, scoped to the project.

PluginListenerHandle

PropType
remove() => Promise<void>

Type Aliases

Record

Construct a type with a set of properties K of type T

{

}

0.0.20

11 months ago

0.0.21

11 months ago

0.0.22

11 months ago

0.0.23

11 months ago

0.0.24

11 months ago

0.0.25

11 months ago

0.0.37

10 months ago

0.0.38

10 months ago

0.0.17

11 months ago

0.0.18

11 months ago

0.0.19

11 months ago

0.0.30

10 months ago

0.0.31

10 months ago

0.0.32

10 months ago

0.0.33

10 months ago

0.0.34

10 months ago

0.0.35

10 months ago

0.0.36

10 months ago

0.0.26

11 months ago

0.0.27

10 months ago

0.0.28

10 months ago

0.0.29

10 months ago

0.0.10

2 years ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.9

2 years ago

0.0.16

2 years ago

0.0.8

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago