Evan
Evan

Reputation: 2507

Ionic Angular GooglePlus : Invalid provider for the NgModule

I'm trying to Integrate GooglePlus signin to Ionic w/ Angular app.

error:

ERROR Error: Uncaught (in promise): Error: Invalid provider for the NgModule 'UsersModule' - only instances of Provider and Type are allowed, got: [Keyboard, ?[object Object]?]

users.module.ts

...
import { GooglePlus } from '@ionic-native/google-plus';

@NgModule({
  declarations: [
    ...
  ],
  entryComponents: [
    ...
  ],
  imports: [
    ...
  ],
  exports: [
    ...
  ],
  providers: [
    ...,
    GooglePlus
  ]
})
export class UsersModule { }

Upvotes: 0

Views: 571

Answers (1)

Rich Tillis
Rich Tillis

Reputation: 1571

You need to change your import path to:

import { GooglePlus } from '@ionic-native/google-plus/ngx';

You may see a build error:

An unhandled exception occurred: The target entry-point "@ionic-native/google-plus" has missing dependencies:
 - @ionic-native/core

Just install the @ionic-native/core dependency and you should be good to go.

npm install @ionic-native/core

Last thought, If you have trouble with that Cordova plugin, another option is @codetrix-studio/capacitor-google-auth. Simon Grimm has a great blog, How to add Capacitor Google Sign In to your Ionic App, which describes all the steps necessary to get Google auth working.

Upvotes: 2

Related Questions