GithubHelp home page GithubHelp logo

apple-auth's Introduction

Apple-Auth

Sign in with Apple for .NET

Install via Nuget.org

Install-Package Golap.AppleAuth

Usage

Apple client

var teamId = "0ABCD123XQ"; // Can be retrieve on the Membership information section (https://developer.apple.com/account/#/membership)
var clientId = "com.my.app"; // Identifier of the Apple Service used to Sign in with Apple (https://developer.apple.com/account/resources/identifiers/list/serviceId)
var redirectUri = "https://my.com/apple/redirect"; // your callback
var keyId = "X987654321"; // Id of the key (https://developer.apple.com/account/resources/authkeys)
var keyPath = "Files/key.p8"; // Can be download during the key creation (https://developer.apple.com/account/resources/authkeys)

var authSetting = new AppleAuthSetting(teamId, clientId, redirectUri);
var keySetting = new AppleKeySetting(keyId, File.ReadAllText(keyPath));

var client = new AppleAuthClient(authSetting, keySetting);

Methods

  • LoginUri() - Generates the Login URI that your users will use to login to
  • AccessTokenAsync(grantCode) - Get the access token from the server based on the grant code returned by Apple
  • RefreshTokenAsync(refreshToken) - Refresh an accessToken from a refresh token

Apple Verifier

var verifier = new AppleVerifier();

Methods

  • ValidateAsync(jwtToken, clientId) - Check an Apple token validity

Common errors

  • "Invalid_grant" error when you go to a generated login uri

  • AppleAuthException when you try to get an access token

    • The grant code is invalid
    • An Apple grant code sent on your redirect URI can only used once for security reasons

Useful links

License

This project is licensed under the MIT License - see the LICENSE.md file for details

apple-auth's People

Contributors

jeremylandon avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.