Bug 28030 - "Unknown" GoogleAuthException with GoogleAuthUtil.GetToken
Summary: "Unknown" GoogleAuthException with GoogleAuthUtil.GetToken
Status: RESOLVED ANSWERED
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 5.2
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2015-03-14 08:37 UTC by Maru
Modified: 2015-06-02 17:18 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Maru 2015-03-14 08:37:50 UTC
I tried to setup my Android app to authenticate with my own server using OAuth 2.0. What I did:

- Creating a Web app in Google Developers Console (Project X).
- Creating a Android app in Google Developers Console (Project X) with the debug keystore (used by me app) and the package name of my app.
- Using the Web apps client id to get the token with GoogleAuthUtil.getToken() where the scope is "audience:server:client_id:" + the Web apps client id.

Result:

com.google.android.gms.auth.GoogleAuthException: Unknown
at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
at dalvik.system.NativeStart.run(Native Method)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
at Android.Runtime.JNIEnv.CallStaticObjectMethod (IntPtr jclass, IntPtr jmethod, Android.Runtime.JValue[] parms) [0x00064] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/9e05e39f/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1161 
at Android.Gms.Auth.GoogleAuthUtil.GetToken (Android.Content.Context context, System.String accountName, System.String scope) [0x00000] in <filename unknown>:0 
at MyProject.<chooserResult>b__3 () [0x00002] in MyProject\File.cs:171 
--- End of managed exception stack trace ---
com.google.android.gms.auth.GoogleAuthException: Unknown
at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
at dalvik.system.NativeStart.run(Native Method)
Comment 1 Jonathan Pryor 2015-06-02 17:18:44 UTC
The "Unknown" message is coming from the GoogleAuthUtil class. I can thus only refer you to their documentation:

https://developers.google.com/android/reference/com/google/android/gms/auth/GoogleAuthUtil#getToken(android.content.Context,%20android.accounts.Account,%20java.lang.String,%20android.os.Bundle)

> In the cases of errors that are neither transient nor recoverable by the the user,
> a GoogleAuthException will be thrown. These errors will typically result from
> client errors (e.g. providing an invalid scope).