android - Generating token to access google account -
i've problem generating second token in application. registered 2 accounts on phone. when use first account token generating, when choose second token isn't generated. code:
accountmanager.getauthtokenbyfeatures("com.google", "manage tasks", null, this, bundle.empty, bundle.empty, new accountmanagercallback<bundle>() { @override public void run(accountmanagerfuture<bundle> bundleaccountmanagerfuture) { try { string token = bundleaccountmanagerfuture.getresult() .getstring(accountmanager.key_authtoken); log.e("token", token); } catch (authenticatorexception e) { e.printstacktrace(); } catch (operationcanceledexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } } }, null);
i following errors:
android.accounts.authenticatorexception: unknown android.accounts.accountmanager.converterrortoexception(accountmanager.java:1726) android.accounts.accountmanager.access$400(accountmanager.java:144) android.accounts.accountmanager$amstask$response.onerror(accountmanager.java:1572) android.accounts.iaccountmanagerresponse$stub.ontransact(iaccountmanagerresponse.java:69) android.os.binder.exectransact(binder.java:407) dalvik.system.nativestart.run(native method)
the second parameter in getauthtokenbyfeatures
should valid scope (eg: oauth2:https://gdata.youtube.com
)
Comments
Post a Comment