Get default user email in iOS Device - ios

Is it possible to retrieve the user email associated with the default email account directly from an app?
Screenshot:
Thanks.

I can't prove a negative, but I am fairly certain this is not possible. You can use MFMailComposeViewController to allow the user to send an email from the default account, but you cannot directly access information about the default account. If you need the user's email address, you either have to ask for them to type it in, or have them select it from their contacts.

In addition to #woz answer, this is a gist that can help you.
In my app, I have a feedback form to let users could get in touch with me. Unfortunately, many users had minor misspellings in their email addresses and I couldn't reach back to them.
As I couldn't get a perfect way to be sure the email was correct, I've developed the following gist which:
asserts the mail is a proper foo#bar.tld
verifies that the email is contained in the user's address book
if not, suggests the closest match
Again, this is far from perfect and I only included this behavior optionally (a little 'check mail' button next to the UITextField)
https://gist.github.com/dirtyhenry/7547064

Related

Sign in with Apple without email id

My application is rejected twice for the “Apple with sign-in“ option. I try to get an email id after the user chooses apple with a sign-in option but in one scenario somehow I don’t get an email id while doing “Sign in with Apple” functionality. I was trying to find ways to reproduce this issue but couldn’t reproduce. Finally today I got to know that in iPhone after creating Apple ID if you go to settings -> Apple ID, you have an option to remove your email id and use the only phone number in place of email id, in this case, I will never get email id while doing “Sign in with Apple”. Unfortunately, my whole application is working based on email id as a primary parameter. In this case, anyone has any idea that how we can handle the uniqueness of the user without changing the architecture of the application?
So the main issue is If the user is using Apple ID as the mobile
number I am not able to get the email address of the user or phone
number
I am stuck in this issue for one week and apple is rejecting my application. Please help me if anyone Is having any idea about it. Thanks in advance
You can use the next steps.
If your users use an Apple sign in and you didn't get an email of the user, then you can simply redirect him to the specific additional step where he should add his email for the end of the registration. After that, you will get an email of this user and it will not necessary to change the architecture of the app

Sign in with Apple ASAuthorizationAppleIDCredential returns random email when user select 'Hide My Email' option for iOS

When I go through the Sign in with apple I am getting first time exact email address and basic details of the user which I want but second time in response there is no email field in response.
My concern is that I want email address of the user so in future I can send notification email to that particular user. but apple gives random created email, in reality that doesn't exists. How to contact to user in future by email?
You might have to register the outbound email with apple, check this for more information on using the private email provided also look at the sign in with apple docs here.
As far as I know the random created email apple gives is actually connected to user's actual mail id. All the mail you send will be forwarded to it. But they can unlink their mail in future. This gives users some privacy and protection from spamming.
When I was finding solution I got to know, we have to pass an email address for following:
The email addresses you register will be able to send and receive messages to and from customers using Apple’s private email relay service.
Once I added this I am able to send and receive the emails.
https://developer.apple.com/account/resources/services/configure
Short answer :
You need to add sender email id or domain name into to your developer account.
Add your email and domain name.
Long answer
You need to follow below steps:
Log in with your developer account in https://developer.apple.com
Goto More section. Please refer below screenshot.
Click on configure button. Please refer below screenshot.
Add domain and email address, You want to communicate.
Add email and domain here

URL in Gmail Alias

At our company, we are working with several aliases. The current situation is that one team of 10 has two aliases. In SalesForce, they would like to put the link to specific emails so that anybody out of the team can open an e-mail related to a claim for instance.
In the e-mail's link, there's the "/u/0" part that identifies the mail gmail account (firstname.lastname#...), but it seems that the aliases have a different number for everybody.
So to be clear when they open the same mail in the shared alias, the e-mail ID stays the same in the URL (logic) but the digit after the "/u/" changes for everybody.
Is there a way to generate a URL that will open the e-mail independently of the person that clicks on the URL ?
Edit:
I'll try to be clearer. Our Customer Service Center employees all have two e-mail adresses: an individual one, and a delegated one. Customers will send e-mails to the delegated one (accessible by all employees). So what we would like to do is copy the link of the e-mail into SalesForce so that any employee (who has access to the delegated gmail) can check the e-mail. But, as explained above, as the individual gmail adress is always identified by a "0" after the "/u/" chain in the URL:
https://mail.google.com/mail/u/0/#inbox/156b821f776b6d4a
the delegated gmail adress is identified by a number that differs depending on the person. So employee A will have "/u/144/" as link to the delegated gmail, another employee will have "u/345/ as link to the delegated gmail. This makes it impossible to access the e-mail by clicking the link...
Hope this little case-study makes the issue clearer.
Thanks in advance
Julien
I'm trying to do this too.
I think the only way (outside of paying for the Google business email system) is to have a database of user IDs that link to each user's gmail delegate URL.
I have a system that allows about 6 or 7 users to login, however they all share the login details (it's a small website, with no important information stored). I will have to force them all to have separate login details, and then have a lookup for their gmail delegate URL.
If you have a lot of staff, then you'd have to get their buy-in. Maybe send a global email around that links to a simple web form, that takes them through how to enter their delegate URL. Then store this in a database, with their own personal email (the other gmail account). You should make the form validation strict, so no garbage gets entered. For users who get stuck (fail validation for entering a valid gmail delegate URL), ask them to email support. 95% of staff should be able to handle this. The other 5% would just be an exercise in patience, in getting the rest of the data.

Implementing normal user/pass, Twitter & Facebook auth

I have created a public facing website which allows you to login using a username/password, or with Twitter, or with Facebook.
When logging in with Twitter for the first time (for example), a user is created in my database with a nickname matching the Twitter screen name. I want this nickname to always be unique.
The problem is that in some cases a user with that nickname already exists, so the user can't be added. I am unsure as to the accepted approach for this problem, the only solution I can see so far is to ask the user to override their nickname, but this doesn't seem too elegant.
The reason the nickname needs to be unique is not a code issue, but an interface issue, for example there are forums and I want each user to be uniquely identified by their nickname.
Are there any other methods anyone can suggest for dealing with this problem?
Edit: At the request of some of the replies I will clarify an example:
Lets say I have a user named Joe Bloggs who is a member on my website. He is not a member of Twitter or Facebook. His nickname on my site is JoeBloggs.
Then, another Joe Bloggs comes along, and wants to sign in with his Twitter account. His Twitter name is JoeBloggs, so when he signs in with Twitter, my system attempts to automatically set his nickname to JoeBloggs. However, this nickname already exists. What is the normal or best practice in the cases where nicknames like this overlap? The only thing I can think of is to prompt the user to specify a different and unique nickname (just for display on my site).
The reason I ask is that this must be a common issue for sites which let you login via Facebook, Twitter, Yahoo - there must be an overlap in the names which are returned from said websites, so I wondered what the normal process is.
Could you use the Twitter API to confirm they really are the Twitter ID they say they are, and if no Twitter account, allow them other means to authenticate (Google+, Facebook, LinkedIn, old school username and password)? Allowing users to login with a Twitter ID that they don't own seems like asking for a world of hurt.
Maybe you could try and change the database itself - get a field like 'nickOrigin', allow there values like '[yourSite]', 'twitter', etc., and only allow new entries if no entry with the same nick AND nickOrigin exists. Execute a query to modify existing users to have a nickOrigin of [yourSite], and things should be backwards compatable, or at least I imagine them that way :)

How to get email (login name) of user in iOS?

I use custom screen with 'from' and 'to' email and textview fields to get feedback from users. So, is there any iOS api to auto fill 'from' field?
I would be seriously surprised if there were as its potentially a big security hole - if not caught by apple it could be used to harvest email addresses.
You can however invoke the email app to do something for you, as described in this other question. Here, the user is in control of whether to send the email or not, so is not a security issue.

Resources