Sigin my app with Google Account in Android - android

I have learned that there are many ways to sign in app with Google Account.
Here are two ways:
Use AccountManager.java ,
GOOD: can get user's email address and authToken.
BAD: can not get user's avatar and nickname.
Use Google+ Api:
GOOD: can get user's all info , but email address.
BAD: no email address, and the view's style is not matching to my app.
QUESTION:
1 .How can i get avatar and nickname by using only AccountManager ?
Is the Google+ Api's view be changed ? Any documents?
Thanks for any help!

You can get the Email address via the Google+ API. You need to add the appropriate scopes and permission.
The scopes are
Scopes.PROFILE
Scopes.EMAIL
And you need the following permission
android.permission.GET_ACCOUNTS
Then you can retrieve the Email address with the AccountApi
Plus.AccountApi.getAccountName(googleApiClient)

You can reference this guide from google doc.
After signin, handle result then get user information.

Related

Can flutter firebase auth tackle multiple social media accounts with same email id?

Does firebase auth help tackle same email id account issue?
For ex. say I am using firebase auth in my flutter app. I have Facebook and Gmail of same email. 1st I create account with Gmail, logout and then 2nd time I try to create account with facebook which has same email ID. Then is firebase designed to give me some type of error message saying "user with this email has already logged in with gmail" and vice-versa ?
Thanks in advance
You can configure whether users can create multiple accounts that use the same email address, but are linked to different sign-in methods. For example, if you don't allow multiple accounts with the same email address, a user cannot create a new account that signs in using a Google Account with the email address ex#gmail.com if there already is an account that signs in using the email address ex#gmail.com and a password.
Please find the details here.
No, Firebase won't throw any error, instead it will create a new account for the second sign-in provider. As Both Sign-In providers are different i.e one is facebook and other is google in your example.
If you really want to create a single account for multiple providers.Then you will need to link multiple providers to an single account.
Checkout Firebase official documentation for the instructions to achieve this on android:-
Firebase Docs

Google Sign In not returning name, picture, given name, family name on iOS but works on Android

I use id_token to communicate with Google Oauth APIs.
Here's the response I get by using the id_token from Android Google Login.
But this is the response I get by using the id_token from iOS Google Login. Some fields are missing. Am I missing something?
I'm using the same account.
Please read all step carefully.
These six fields are included in all Google ID Tokens
iss,sub,azp, aud,iat,exp
These seven fields are only included when the user has granted the
"profile" and "email" OAuth scopes to the application.
email, email_verified, name, picture, given_name, family_name, locale
Conclusion:
It seems like you do not give permission to access profile while doing login with iOS Device.

How can I get user info from a google account?

I want to allow my app users to log on/register with a google account. I need to retrieve the following about a user
A unique id, first name, last name, email
Is it possible in android or do I have to use one of goooles services like picasa api to get this information about a user?
Login with Google+
https://developers.google.com/+/mobile/android/sign-in
Retrieve profile info
https://developers.google.com/+/mobile/android/people

Google+ Api - get associated account in android

I'm using the new Google+ Sign-in api. Once a user clicks sign in they can choose which google account to use, and then proceed to authorize the app. How can I get the account which they picked?
Reason being is I have been using regular google auth for my app and the users account is tied to the email address. With this Google+, I'm not sure how to get the account email without asking the user to selected the account again.
You can retrieve the user's profile information by using the PlusClient.loadPerson() method, which can include their email address if they choose to make it public. To reliably get their email address, you would use either the PlusClient.getAccountName() or use the userinfo REST endpoint after requesting the userinfo.email scope.
The code examples in the documentation walk through each of the above cases.

Fetch all Email address of facebook user in android

i m creating application in which i have to obtain friend list of facebook user account which i got but now i have to also obtain their Email addresses but not getting any kind of hint , tell me how can i fetch all Email addresses of facebook users in android
AFAIK Its not possible cause Facebook API doensn't provide it.
From Experience:
You can search and read a bit more in Facebook Graph API permission and you will find for contact information need to give extra permission "email" but while fetching user acoounts of Friends you wont get them even if they(friends) have set their info shared to everyone.

Categories

Resources