CodetrixStudio / CapacitorGoogleAuth

Capacitor plugin for Google Auth. Lightweight & no dependencies.
MIT License
284 stars 158 forks source link

java.lang.NullPointerException #159

Open dipankarmondal opened 3 years ago

dipankarmondal commented 3 years ago

Hi guys, please help. my app crashing during startup throwing this error java.lang.NullPointerException: Attempt to invoke virtual method 'int org.json.JSONArray.length()' on a null object reference at com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth.load(GoogleAuth.java:48)

I have followed the documentation and this is my capacitor.config.json

( "GoogleAuth": { "scopes": [ "profile", "email" ], "serverClientId": "web Client ID", "forceCodeForRefreshToken": true } )

image

jeremy379 commented 2 years ago

Hi I noticed capacitor.config.json doesn't really works, I was able to achieve it by doing the configuration inside capacitor.config.ts

import { CapacitorConfig } from '@capacitor/cli';

const config: CapacitorConfig = {
  appId: 'com.my.app',
  appName: 'My app',
  webDir: 'www',
  bundledWebRuntime: false,
  "plugins": {
    "GoogleAuth" : {
      "androidClientId": "XXXXX.apps.googleusercontent.com",
      "iosClientId": "XXXXX.apps.googleusercontent.com",
      "scopes": ["profile", "email", "openid"],
      "forceCodeForRefreshToken": true
    }
  }
};

export default config;
raykin commented 2 years ago

iosClientId config doesn't in work capacitor.config.json for me either. I try to copy GoogleService-Info.plist by xcode and it works. Will try android on next day.

Chris8800 commented 2 years ago

@jeremy379 this may come too late, but it solved my issue with java.lang.NegativeArraySizeException: -1. Thanks a bunch!