npm package: @gigsters/google-auth
Description: Ionic capacitor plugin to authorize via Google Sign In
Author: Heiko Jungholt
Latest version: 1.0.0

# @gigsters/google-auth

Ionic capacitor plugin

## Install

```bash
npm install @gigsters/google-auth
npx cap sync
```

## API

<docgen-index>

* [`signIn()`](#signin)
* [`signOut()`](#signout)
* [`initialize(...)`](#initialize)
* [`addListener('userChanged', ...)`](#addlisteneruserchanged)
* [`removeAllListeners()`](#removealllisteners)
* [`renderButton()`](#renderbutton)
* [Interfaces](#interfaces)
* [Type Aliases](#type-aliases)

</docgen-index>

<docgen-api>
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->

### signIn()

```typescript
signIn() => Promise<GoogleUser | undefined>
```

**Returns:** <code>Promise&lt;<a href="#googleuser">GoogleUser</a>&gt;</code>

--------------------


### signOut()

```typescript
signOut() => Promise<any>
```

**Returns:** <code>Promise&lt;any&gt;</code>

--------------------


### initialize(...)

```typescript
initialize(options?: Partial<InitOptions> | undefined) => void
```

| Param         | Type                                                                                      |
| ------------- | ----------------------------------------------------------------------------------------- |
| **`options`** | <code><a href="#partial">Partial</a>&lt;<a href="#initoptions">InitOptions</a>&gt;</code> |

--------------------


### addListener('userChanged', ...)

```typescript
addListener(eventName: 'userChanged', listenerFunc: (googleUser: GoogleUser) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
```

| Param              | Type                                                                       |
| ------------------ | -------------------------------------------------------------------------- |
| **`eventName`**    | <code>'userChanged'</code>                                                 |
| **`listenerFunc`** | <code>(googleUser: <a href="#googleuser">GoogleUser</a>) =&gt; void</code> |

**Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>

--------------------


### removeAllListeners()

```typescript
removeAllListeners() => Promise<void>
```

--------------------


### renderButton()

```typescript
renderButton() => void
```

--------------------


### Interfaces


#### GoogleUser

| Prop              | Type                |
| ----------------- | ------------------- |
| **`idToken`**     | <code>string</code> |
| **`id`**          | <code>string</code> |
| **`name`**        | <code>string</code> |
| **`email`**       | <code>string</code> |
| **`photoUrl`**    | <code>string</code> |
| **`firstName`**   | <code>string</code> |
| **`lastName`**    | <code>string</code> |
| **`accessToken`** | <code>string</code> |


#### InitOptions

| Prop                     | Type                 | Description                                                                                                                                                            | Default            |
| ------------------------ | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| **`grantOfflineAccess`** | <code>boolean</code> | Set if your application needs to refresh access tokens when the user is not present at the browser. In response use `serverAuthCode` key !!! Currently unsupported !!! | <code>false</code> |


#### PluginListenerHandle

| Prop         | Type                                      |
| ------------ | ----------------------------------------- |
| **`remove`** | <code>() =&gt; Promise&lt;void&gt;</code> |


### Type Aliases


#### Partial

Make all properties in T optional

<code>{ [P in keyof T]?: T[P]; }</code>

</docgen-api>