How to fetch email id from LinkedIn android? - android

How do I fetch the email address from LinkedIn profile in my Android app?

You need to set scope with email permission. After that you will be able to recover that specific data.
private static Scope buildScope() {
return Scope.build(Scope.R_BASICPROFILE, Scope.W_SHARE, Scope.R_EMAILADDRESS);
}
Then use following URL to make GET request.
String url = "https://api.linkedin.com/v1/people/~:(id,first-name,last-name,public-profile-url,picture-url,email-address,picture-urls::(original))";
With this scope your ApiResponse will retrieve user's email.

Did you check the API documentation? From what I can see, there is no way to get the email ID from their API. My guess is that LinkedIn protects this particular information (as they should). If they allowed my personal information to be retrieved by anyone with access to the API I would likely get a lot more spam then I do.
I don't think you can access this information.
https://developer.linkedin.com/documents/people

Related

GIS SignInCredential does not contain field named "email", despite documentation guarantees

The Google Identity Services documentation for Android clearly states:
The result of a successful sign in always returns the users full name, email, and profile picture url.
And yet, the returned SignInCredential object does not expose email. It contains the name and profile picture URL, but not the email.
Is this
Documentation error;
SDK error;
My error?
And how do I obtain user email from Google Identity Services without going through People API then?
you can use :
signInCredential.getId();
you will get email .

When to use FirebaseAuth user uid and when to use an E-mail as identifier

With This Question in mined here´s a follow up question.
Correct me on my assumptions please my learning curve is aggressive :).
If making lets say a chat app having Firebase as backend storage, then using the FirebaseAuth.getInstance().getCurrentUser().getUid() uid inside the chat system as a chat member identifier, a bad idea if, you allow users to delete there account, and allowing account linking. The uid would change and that would break the database right?
My next assumption now is that to have a secure user id inside the chat app one can use the signed in E-mail address right because it´s a trusted provider!?
My conclusion is to never use the getCurrentUser().getUid() uid as an identifierar for the user or?
It's not a bad idea to use getCurrentUser().getUid() but a better idea is to use as an identifier the email address. I'm saying this because in the case in which the user is is deleting the account and than returns, the uid will be for sure different. Because Firebase does not allow the dot symbol . in the key, the email address must be encoded like this:
name#email.com -> name#email,com
As you probably see, i have changed the . with ,. To do this, i recomand you using this methods:
static String encodeUserEmail(String userEmail) {
return userEmail.replace(".", ",");
}
static String decodeUserEmail(String userEmail) {
return userEmail.replace(",", ".");
}
Hope it helps.

AWS Cognito- get user information with ID

Is there any way to get information about the user in AWS Cognito pool (on android) who is not logged in, knowing his ID? I tried that code:
AppHelper.getPool().getUser(username).getDetailsInBackground(detailsHandler);
However it works only for username who is currently logged in.
No, there is not.
You get get user information given the user name by calling AdminGetUser from you backend with your developer credentials but not from an Android client.
Use ListUsers() Api , with filters ie
client = boto3.client('cognito-idp', region_name=USER_POOL_REGION)
user = client.list_users(
UserPoolId = USER_POOL_ID,
AttributesToGet=attributes, # ie ['email', 'sub',]
Filter='sub = "<user-id-here>"',
#Limit=limit
)
for complex filters and examples see https://docs.aws.amazon.com/cognito/latest/developerguide/how-to-manage-user-accounts.html#cognito-user-pools-searching-for-users-listusers-api-examples

Access Twitter API after firebase simple login

So I am using twitter as my authentication mechanism and after a successful login I am able to make calls to access the twitters users information listed here: https://www.firebase.com/docs/android/guide/login/twitter.html
String username = (String)authData.getProviderData().get("username");
String displayName = (String) authData.getProviderData().get("displayName");
Calls like those work perfectly but I want to be able to post tweets as well and I am not sure how to do so after twitter authentication.
There are no real guides in the firebase documents so any help would be appreciated.

android app authorisation

I am making an application in android. How to do role authorisation in android. is there any package. please let me know.
Thanks,
NVN
I never used the Authenticator class. But if you plan to role your own authentication system, its pretty simple. Here are some tips:
Authenticate over https
Create a webservice that accepts username and password.
Once succeeded, save a token or
something in preferences so the app
knows it is authenticated.
I recommend using an oAuth
implementation because it is the most
safe. (Don't store email addresses,
instead use tokens)
Let me know if you need any other help.
Edit:
There isn't a library out there does this for you. You have to create a class called Token or User:
class Token{
String token;
Role role;
User user;
}
Role can be an enum like enum Role{admin, publisher, writer, reader,...}.
Then let's say you authenticate against https://foobar.com/REST/authenticate/?user=foo&password=...
Which returns a simple JSON or XML (I suggest JSON)
{
token: "12345667",
role : "publisher",
user : { userId : "amir", ...}
}
So now you make an HTTPS call and authenticate against a user and password. Then parse the json and create a Token object. Store this token object in the app and you should have everything you need.
Have you looked at the default Authenticator class? Here's the API from Google I hope that helps. =]

Categories

Resources