I want to use AccountManager in Android, to verify a com.google account. I've already know how to get the account, But I've got several questions,
If the account is not in AccountManager, and the account self is under com.google domain, then how can I add it?
How AccountManager manage tokens? It retrieves tokens automatically, or I need to do it manually?
I'm trying to use Google Reader API with ClientLogin, then I may need password for the first time. If some com.google accounts are stored previously by other apps, can I use them to get the password?
Edit on 2011.08.20
To clarify the question, what I want to ask it this,
Google applications on Android has its own routine to verify Google accounts, and I want to know whether it's possible to call the routine created by Google applications, and get my own authority?
If there's no Google Account on Android phone, how can I add an account, which will be accepted by Google applications later?
If the account is not in AccountManager, and the account self is under com.google domain, then how can I add it?
If you simply want to have, for example, a button that lets the user add a Google account, consider invoking the ADD_ACCOUNT intent. Another, more advanced, option is to use AccountManager.addAccount.
How AccountManager manage tokens? It retrieves tokens automatically, or I need to do it manually?
The system manages tokens. Well, actually, applications register 'authenticators' which manage tokens for their corresponding service. An authenticator for Google accounts comes preloaded with most Android devices, and third party apps like Twitter add their own authenticators when installed. Apps that want to use Google accounts can request authentication tokens using AccountManager.getAuthToken.
I'm trying to use Google Reader API with ClientLogin, then I may need password for the first time. If some com.google accounts are stored previously by other apps, can I use them to get the password?
Your app should never ask the user for her Google password. Use the relevant AccountManager methods to request an auth token for Reader. Unfortunately, since Google Reader doesn't have a public API I can't assist further.
Related
I'm using angular, google app engine and JAVA on the backend server.
User can authenticate without problem with an opendId connect URL where code is passed back to my server to authenticate.
Now what I wan't to do is send mail to user (refresh password, confirm account mail) and to myself (server error message) with my account myaccount#gmail.com.
Also I have sheets I need user to write and read datas to/from. Magically I've made it worked as an installed offline app (only 1 api at a time, I never made the two worked together).
I've tried service account but from a last post somebody explained me that in order to make gmail work I needed a g suite account which I don't have and suggest me to go through oAuth2 authentification. Now the question is how can I implement that in java with a single authentification, I explain, I wan't to authorize app to have access to certain scopes but it should be only be authorized once because I don't want user to have a consent screen popup and even if they had they couldn't authenticate as it is on the behalf of my personnal account. I don't think I can use installed app for a google app engine app but maybe I'm wrong.
just to let you know I have tried lot's of different manners and spent about 3/4 days trying to find a solution without clearly understanding/finding what to do.
Any help is greatly appreciated please let me know if you need more explanations or code.
I think you are missing a few key concepts here.
DATA
There are two types of data private user data and public data. Private user data is owned by a user and there for you must have permission or concent to access it. Public data is data that is owned by anyone.
Oauth2
Oauth2 is the protocol we use to request connect from a user for our applications to access their data. A user can grant you access to their gmail account and their google drive account granting you access to the sheets on their account.
Service accounts
Service accounts are preapproved dummy users. As a developers we can create service accounts and grant them access directly to our drive account then the service account will then be able to access to the data without being requiring consent as it already has pre approved access. (not all google apis support service accounts. gmail (with the exception of gsuite) and YouTube are two that dont)
What you are trying to do
However i do not understand why you want to use the users gmail account to send them an email. If you want to send them an email i would think you would be using your own email system.
If what you are trying to do is use your gmail account to send users of your application emails from YOU. Then you should consider going directly though the SMTP server to your own account. Having an application that uses the gmail api is one of the scopes that will be flagged by google when you try to get your application approved. You are going to be going though a lot of red tape with them to show why you need access to a users gmail account.
(Google Developers)Does Deleting google account provide callback to the all the apps to which we login via google account?
If we are deleting a google account, does google sends the callback to all the app which are linked to it for instance any thirdparty sign, which we do with the help of google account like cleartrip, oracle login or makemy trip etc.
No it does not work that way. The login process for an app is one way, meaning that the app will send login information to Google and Google will either provide a valid user or not.
Up to my knowledge, Twitter has stopped using username and password authentication in order to post tweets from a Java app. However, it allows OAuth only (using consumer keys, access tokens etc.).
Is there still any approach or workaround to use username and password based authentication to tweet from a Java app?
No there isn't anymore. If you want to be able to use the API you must follow these steps:
Go to Twitter Apps and login with your regular twitter account
assuming you have one, if not you need to create one.
Once signed in click on Create New App button.
Fill out the application (Name, description, and whatever else it
requires).
Create your key and access tokens. Share those with users that you
trust as they'll be used to access the twitter API to read/write
information.
Give the application you created a "Read and Write" permission based
on what you asked in the question.
Then depending on the software/language you use there's a plenty of existing packages that can help you access and obtain the information from the API.
I know there are other questions regarding this issue, but even after reading those, looking at the associated links and checking the QuickBooks docs, I'm struggling to understand it all and I feel like I'm going around in circles.
I need to create a load of invoices in my QuickBooks Online account based on data in Excel/CSV files. I will take a long time to do it manually (as well as being really tedious work) and I'll have to do it again in the future. I'm just trying to write a Java desktop application that will parse the file data and create the invoices in QuickBooks Online.
This is only for me and only for my companies QuickBooks account. I don't need my application to access other QuickBooks accounts, but I understand that I still need to go through the oAuth process (or do I?) to get the credentials that will allow me to make requests.
OAuthRequestValidator oauthValidator = new OAuthRequestValidator(
accessToken, accessTokenSecret, consumerKey, consumerSecret);
ServiceContext context = new ServiceContext(
realmID, IntuitServicesType.QBD, oauthValidator);
I keep hearing that I have to register my app with Intuit to get the consumerKey and consumerSecret, but when I try to do that through developer.intuit.com, it's requiring an app URL and host name domain. This is a desktop app, I don't have those.
Is there seriously no way to simply access my QuickBooks Online account using the SDK by just supplying my userID and password?
I understand that I still need to go through the oAuth process (or do I?)
Yes, you do.
but when I try to do that through developer.intuit.com, it's requiring an app URL and host name domain.
Just enter in localhost to get through the registration process.
Then, you can use Intuit's OAuth Playground tool to get the access tokens you need, without having to actually implement any website-based stuff.
https://appcenter.intuit.com/Playground/OAuth
Is there seriously no way to simply access my QuickBooks Online
account using the SDK by just supplying my userID and password?
There is no way to access your QuickBooks Online account programatically with just a username and password. You need to use OAuth.
It's really not that difficult if you just enter localhost in and use the Playground tool. Should take all of 30 minutes tops to get going.
Is it possible to obtain a OAuth2 token to use with Google APIs, using the android AccountManager? The only other way I know of would be to have a webView and make the user log in to obtain the OAuth2 token, but it would seem to be a lot of work for that many people would want to do, so if I could just obtain it using AccountManager that would be much better. Is there any functionality like this?
AccountManager is not for generating tokens at all - its only for storing credentials related to an Account. These classes are not specific to Google server accounts - you can use them for any type of account. For example, I use them to store OAuth2 tokens for Facebook, Twitter, etc.
You will need to use the Google APIs to generate an OAuth2 token, which you store in an Account using the AccountManager. You need to use the Google APIs, because part of the OAuth2 token generation occurs on the server itself - Google will store a record of the tokens it has given out, and the server accounts that they are related to. If you didn't call the Google APIs to generate the token, Google wouldn't know how to match the token to a Google server account.
Your approach of using a WebView to obtain the OAuth2 token is the correct way to do this.
Once you have the OAuth2 token stored for the Account, you just retrieve it from the AccountManager whenever you want to use it to make a query. So, you only need to generate the OAuth2 token once (unless it expires), and then you keep using it over and over again.