I use google oauth2 to authorize users in my spring app. I can retrieve first and last name, email. But I also need to get their phone number and profession (jobTitle). How to retrieve phone number and profession from profile about me?
I used all scopes in application.yml- openid, email, profile, address, phone. There is no information in the (DefaultOidcUser) authentication.getPrincipal() object that I need. Maybe I need to use Google People API for it?
If you are already getting the names and email then all you need to do is add occupation and birthday to the personFields property its a coma separated field so the following should do it.
names,occupations,birthdays,email
The issue will probably be the scopes you are requesting. You will probably need to add.
https://www.googleapis.com/auth/user.birthday.read
https://www.googleapis.com/auth/user.organization.read
Related
I'm working with telegram bot and i have this method to get user messages.
I need to find a way to get a link to the user who send this message
I saw there are this method, but i dont know how to connect them to a "link" to a profile
#Override
public void onUpdateReceived(Update update) {
update.getMessage().getFrom();
// i have: getFirstName(), getLastName() - not helping
// i have also getId() - but its a number how do i convert it to a link to telegram profile ?
}
Having username is optional on Telegram, setting it up means other people will be able to contact the user without knowing their phone number. Only users that chose their username in Telegram settings have a profile link, and the link is of the form https://t.me/<username>.
For ordinary messages, you can get the username via update.getMessage().getFrom().getUsername() and use it to create profile links, however, note that for many users this value will be empty (meaning they don't have a profile link).
Also, if you keep database of chat IDs, you can get usernames of the users via getChat Telegram API call. This can be useful because while usernames can be changed by the user any time (meaning their profile link will also change), chat ID of the user is constant over time and the getChat method will always provide you with the most recent information.
In Firebase, I register the user with e-mail on the authentication side and after registration I send e-mail verification to this user, but in addition to this, I define some other features in my system, such as name, phone number while registering. I will combine these features and keep them in user collections in firestore. At the same time, I want to send an sms-code to the phone number of the data whose e-mail and password are matched in the user collections with the e-mail and password entered by the user while logging in to the system, and I will instantly verify this every time for the user to log in. Is it possible for me to do something like this or should I just choose one over email or phone?
Yes absolutely it is possible, use both authentication method one by one (email first then phone OTP) and while registering after creating user with email and password and sending otp to the user, instead of doing createUserWithCredentials use linkUserWithCredentials. This will create one user with both email and phone number authentication instead of creating two separate users for two different credentials.
I am building an invitation form in which the user can fill an email or use a button that will open a contact app in his device and will get the email of a chosen contact(if email exists). I wonder if this kind of button is possible to achieve in Codename One without listing all the user's contacts in my app.
Thanks!
Itay
According to the official API, you may only use id to retrieve a certain contact using method getContactById(String id).
So, the answer is "No", you cannot get the contact by its email since you don't know the mapping id <> email
I have a question relating to get all profiles ( email, phone, address ) after logging successfully in WSO2 Identity Server.
After login, we can have cookie(sessionID) and then based on this, we can use UserStoreManager to get roles, list user, profiles... and as mentioned in the below link.
I can get use function to get profiles getProfileNames() but the result when I call is only ["default"] while I inputted my email, phone, address, etc in userprofile section in console.
I appreciate your help in this case.
Hope that you can help me. Thanks
https://docs.wso2.com/display/IS510/Managing+Users+and+Roles+with+APIs
Right, so what you are trying to achieve is to get claim values(email, phone etc.) of a user.
for this, you can use the getUserClaimValue()[1] or getUserClaimValuesForClaims()[2]
Both these method take in three arguments,
Username of user
Claim name / Claim names you are trying to retrieve (email, gender etc.)
Profile name (you can pass null, then values from default profile will return)
[1] https://docs.wso2.com/display/IS510/Managing+Users+and+Roles+with+APIs#ManagingUsersandRoleswithAPIs-getUserClaimValue()
[2] https://docs.wso2.com/display/IS510/Managing+Users+and+Roles+with+APIs#ManagingUsersandRoleswithAPIs-getUserClaimValuesForClaims()
I am currently using federated authentication via openid in appengine - using google, yahoo, myopenid as the providers
Had a question as to what I should be storing in my db to identify returning users.
I am currently storing user.getNickname() - (for google and yahoo this returns the users email address).
User user = userService.getCurrentUser();
String username = user.getNickname();
I use this to store and retrieve user specific data.
Is this the right way to proceed? Is the getNickName() unique? I see that User also has a user.getUserId() method and a user.getEmailId() method.
should I be using user.getUserId() instead?
getNickname() - don't use this.
getUserId() - this is logical, but the problem could be if users forget which identity they used with your site (I have multiple accounts with google, plus yahoo and facebook). This could lead to creating multiple account for one person. But then, some people want this. Also, this remains the same for Google users even if they change their email.
'getEmail()` - is actually similar to ID - uniquely identifies user. CAN be different then ID if users use alias email to log in.
Anyhow, when users log in for the first time you should present them with Account Details page (like SO does). Also, you should give users ability to aggregate identities into one account.