Get the user email address when using OAuth

When creating a login page with an OAuth provider (Facebook, Google, Microsoft or Twitter), you can get additional information about the user logging.

To get an email address, use the $ClaimsPrinciple variable and find the claim for the email address.

($ClaimsPrinciple.claims | where type -like "*emailaddress" ).Value