Obtaining Your users' E-Mail Addresses
Another way that you can notify your users, send them invitations, and so on is to just send them an e-mail. For each user in your application who gives you permission, you can obtain his or her e-mail address. you'll want to store this in a database somewhere when you get it, and as long as you regularly check that permission (or use real-time notifications to notify you when it changes — I cover this in Chapter 11), you can then use the e-mail address to send the user e-mail updates.
This method is only available to users of your own application. Because your users' friends may not have given your application permission to access their e-mail addresses, your application cannot send e-mail messages or invites to the users' friends. Use the request architecture I mention previously to do that.
To obtain the e-mail addresses of your users, you just need to do a few things — note that this may be a little advanced for some readers. You may want to point your developers to this section if you still need this functionality and it doesn't make sense to you. Here are the steps:
- Add the “e-mail” data permission to your list of permissions.
Your login link from the authorization example above in your Inspirations application should now look like what is shown below. Basically, I just added a scope parameter to the URL, and added “email” to the comma-delimited ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access