Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,36 @@ Register plugin and manually initialize
```ts
import { GoogleAuth } from '@codetrix-studio/capacitor-google-auth';

// use hook after platform dom ready
GoogleAuth.init()
```


Use it
```ts
GoogleAuth.signIn()
```

#### AngularFire2

init hook
```ts
// app.component.ts
constructor() {
this.initializeApp();
}

initializeApp() {
this.platform.ready().then(() => {
GoogleAuth.init()
})
}
```

sign in function
```ts
async googleSignIn() {
let googleUser = await Plugins.GoogleAuth.signIn();
let googleUser = await GoogleAuth.signIn();
const credential = auth.GoogleAuthProvider.credential(googleUser.authentication.idToken);
return this.afAuth.auth.signInAndRetrieveDataWithCredential(credential);
}
Expand Down Expand Up @@ -115,7 +133,7 @@ Provide configuration in root `capacitor.config.json`
Note : `forceCodeForRefreshToken` force user to select email address to regenerate AuthCode used to get a valid refreshtoken (work on iOS and Android) (This is used for offline access and serverside handling)


### Migration guide
## Migration guide

#### Migrate from 2 to 3

Expand All @@ -125,7 +143,7 @@ After [migrate to Capcitor 3](https://capacitorjs.com/docs/updating/3-0) updatin
```diff
- import "@codetrix-studio/capacitor-google-auth";
- import { Plugins } from '@capacitor/core';
+ import { GoogleAuth } from '@codetrix-studio/capacitor-google-auth';
+ import { GoogleAuth } from '@codetrix-studio/capacitor-google-auth'

- Plugins.GoogleAuth.signIn();
+ GoogleAuth.init()
Expand Down