AppWerft / Ti.GoogleSignIn

Use the native Google Sign In SDK in Appcelerator Titanium. 🚀
Other
24 stars 12 forks source link

Can't ask for Offline token access? #29

Open oakleaf opened 5 years ago

oakleaf commented 5 years ago

Hello, it seems I cant use;

    Google.initialize({
        clientID: App.Constants.GOOGLE_API_TOKEN,
        scopes: App.Constants.GOOGLE_FIT_SCOPES,
        access_type: 'offline'
    });  

to retrieve Offline access (E.g a "backend token") so we may get data from our backend. Is it possible to add this feature to this module?

deckameron commented 5 years ago

Hi @oakleaf,

I have implemented the Access Token. Could please check if this is what you need?

The response should have something like this :

"accessToken": "ya29.BucfHbDFMIGBucfHbDFMIGBucfHbDFMIGBucfHbDFMIGBucfHbDFMIG"
oakleaf commented 5 years ago

Hi @oakleaf,

I have implemented the Access Token. Could please check if this is what you need?

The response should have something like this :

"accessToken": "ya29.BucfHbDFMIGBucfHbDFMIGBucfHbDFMIGBucfHbDFMIGBucfHbDFMIG"

Hey, sounds awesome (If this would be the case) but Im getting this error when I try your module:

[ERROR] : TiExceptionHandler: (main) [2900,3238] Google.signIn(); [ERROR] : TiExceptionHandler: ^ [ERROR] : TiExceptionHandler: Error: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference [ERROR] : TiExceptionHandler: at GoogleFitCallback (eval at Module._compile (app://app.js:728:13), :132:20) [ERROR] : TiExceptionHandler: at View.buttonClickListener (eval at Module._compile (app://app.js:728:13), :89:13) [ERROR] : TiExceptionHandler: at View.value (ti:/events.js:49:21) [ERROR] : TiExceptionHandler: at View.value (ti:/events.js:101:19) [ERROR] : TiExceptionHandler: [ERROR] : TiExceptionHandler: ti.googlesignin.GooglesigninModule.signIn(GooglesigninModule.java:156) [ERROR] : TiExceptionHandler: org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method) [ERROR] : TiExceptionHandler: org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:63) [ERROR] : TiExceptionHandler: org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:971) [ERROR] : TiExceptionHandler: org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1196) [ERROR] : TiExceptionHandler: org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:401) [ERROR] : TiExceptionHandler: android.os.Handler.dispatchMessage(Handler.java:101) [ERROR] : TiExceptionHandler: android.os.Looper.loop(Looper.java:164) [ERROR] : TiExceptionHandler: android.app.ActivityThread.main(ActivityThread.java:6938) [ERROR] : TiExceptionHandler: java.lang.reflect.Method.invoke(Native Method) [ERROR] : V8Exception: Exception occurred at undefined:132: Uncaught Error: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference

deckameron commented 5 years ago

@oakleaf Could you try this version, please?

oakleaf commented 5 years ago

I dont think that's the offline token though, have you requested offline request for that token?

On Wed, Feb 20, 2019 at 1:27 PM Douglas Alves notifications@github.com wrote:

@oakleaf https://github.com/oakleaf Could you try this version https://github.com/deckameron/Ti.GoogleSignIn/blob/master/android/dist/ti.googlesignin-android-4.0.1.zip?raw=true, please?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AppWerft/Ti.GoogleSignIn/issues/29#issuecomment-465553955, or mute the thread https://github.com/notifications/unsubscribe-auth/AAa-NvGy7KOOREe6oegqh4F4BXJw94oYks5vPT9OgaJpZM4a76rR .

-- Med vänliga hälsningar, Mathias Eklöf Appitude.io https://appitude.io mathias@appitude.io +46 70 30 555 31

oakleaf commented 4 years ago

This seems to work for the iOS-version. Why is this not in sync with that one?

currentUser (Dictionary, get) id (String) scopes (Array) serverAuthCode (String) <---- This is what we need hostedDomain (String) profile (Dictionary) name (String) givenName (String) familyName (String) email (String) hasImage (Boolean) authentication (Dictionary) clientID (String) accessToken (String) accessTokenExpirationDate (Date) refreshToken (String) idToken (String) idTokenExpirationDate (Date)