Skip to content
A sample implementation of Sign in with Apple using ASP.NET Core
C# HTML PowerShell CSS
Branch: master
Clone or download

Latest commit

martincostello Update Bootstrap
Update to the latest version of Bootstrap and jquery.
Latest commit 7f707ac Mar 29, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
.vscode Update to ASP.NET Core 3.1 Dec 9, 2019
src/SignInWithApple
.editorconfig Use GitHub Actions for CI Mar 28, 2020
.gitattributes
.gitignore Add solution Jun 10, 2019
CODE_OF_CONDUCT.md Add solution Jun 10, 2019
LICENSE Add solution Jun 10, 2019
NuGet.config Remove aspnet-contrib NuGet feed Oct 14, 2019
README.md Use GitHub Actions for CI Mar 28, 2020
SignInWithApple.sln
build.ps1
global.json Update to ASP.NET Core 3.1.3 Mar 25, 2020

README.md

Sign in with Apple Example Integration

Build status

This repository contains a sample implementation of Sign in with Apple for ASP.NET Core 3.1 written in C#.

Overview

Sign in with Apple is a way of allowing users of websites to sign in using their Apple ID.

This example integration shows a minimal sample of how to integrate Sign in with Apple a website to authenticate a user using their Apple ID and retrieve their email address (or a relay address to it) and their name.

Setup

To setup the repository to run the sample, perform the steps below:

  1. Install the .NET Core SDK, Visual Studio or Visual Studio Code version compatible with .NET Core 3.1.
  2. Fork this repository.
  3. Clone the repository from your fork to your local machine: git clone https://github.com/{username}/SignInWithAppleSample.git
  4. Follow the steps to obtain your Client ID, Private Key, Key ID and Domain Verification file, if you do not already have them.
  5. Place the Domain Verification file (apple-developer-domain-association.txt) in the src\SignInWithApple\wwwroot\.well-known folder.
  6. Either add your .p8 file contining the private key to generate the client secret to the root of the application in src\SignInWithApple (but not in the wwwroot folder), or use some other mechanism, such as loading it from a blob storage account.
  7. Update the favicon (src\SignInWithApple\wwwroot\favicon.ico) to your own design.
  8. Configure the following settings as appropriate in either your environment variables or in src\SignInWithApple\appsettings.json:
    • AppleClientId
    • AppleKeyId
    • AppleTeamId
  9. Deploy the application to the hosting environment for the domain where you wish to use Sign in with Apple.
  10. Verify the domain in the Apple Developer Portal.

You should now be able to sign in with your Apple ID in the deployed application.

Local Debugging

You should be able to debug the application in Visual Studio Code or Visual Studio 2019 (16.4 or later).

Azure App Service Deployment

If you are deploying the sample application to a Microsoft Azure App Service Web App, you will need to make the following configuration changes to your Web App for the sample application to run correctly:

  • Navigate to the Application settings tab of your Web App and add the following settings:
    • WEBSITE_LOAD_USER_PROFILE to a value of 1.
    • Save the changes.
  • Ensure the hostname you are using (either {yourappname}.azurewebsites.net or a custom hostname that you have set up) has been added in the Apple Developer portal to your service id and you've added the Apple Developer domain validation file as described in the Setup section above.

Feedback

Any feedback or issues can be added to the issues for this project in GitHub.

License

This project is licensed under the Apache 2.0 license.

External Links

You can’t perform that action at this time.