Giter VIP home page Giter VIP logo

apple-sign-in-rest's Introduction

Hi there! πŸ‘‹

renarsvilnis github stats

apple-sign-in-rest's People

Contributors

breyed avatar renarsvilnis avatar techofficer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

apple-sign-in-rest's Issues

Requesting additional API fialure metadata be attached to promise rejections

While using the appleSignIn.getAuthorizationToken() method I was getting the following error rejection:

Error: Authorization request failed with reason "invalid_grant" and status code "400"
    at AppleSignIn.getAuthorizationToken (/home/tlhunter/FOO/server/node_modules/apple-sign-in-rest/lib/AppleSignIn.js:114:23)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.handler (file:///home/tlhunter/FOO/server/lib/routes/v1/auth.mjs:279:32)

That error made it difficult to find the true issue.

I did some research and saw suggestions that the Apple server returns additional metadata in the error response. I edited the compiled code in AppleSignIn.js line 114 and threw in a console.error(err) and got the following data on the Axios request object.

    data: {
      error: 'invalid_grant',
      error_description: 'redirect_uri mismatch. The code was not issued to https://example.org/account-create-FOO/apple.'
    }

I'd like to request that the rejected promise contain the additional error_description metadata from the response object.

Typing of scope incorrect

scope?: "name" | "email"[];

Is incorrect. You meant ("name" | "email")[] but this is also not perfect :-).

Don't be clever, just unfold it:

scope?: ["email","name"]|["name","email"]|["name"]|["email"]|[]

Insecure jsonwebtoken

This library depends on jsonwebtoken@8 which contains a security vulnerability. It should instead update to use jsonwebtoken@9.

Note that this project is no longer maintained. But it's possible to force the underlying dependency to be updated by adding this to one's package.json:

"overrides": {
  "apple-sign-in-rest": {
    "jsonwebtoken": "^9.0.0"
  }
}

Some minor typos in README.md

In step 1.

privateKeyPath: '/Users/arnold/my-project/credentials/AuthKey.p8';

Remove ;.

In step 2.

const authorizationUrl = appleSignin.getAuthorizationUrl({

The instance was declared as appleSignIn (note capital I).

redirectUrl: "http://localhost:3000/auth/apple/callback",

It's not Url it's Uri.

Support for real_user_status

Apple introduced a real_user_status which is not returned by apple-sign-in-rest. You can find more about it here.

Here's a gist of it:

real_user_status:
An Integer value that indicates whether the user appears to be a real person. Use the value of this claim to mitigate fraud. The possible values are: 0 (or Unsupported), 1 (or Unknown), 2 (or LikelyReal). For more information, see [ASUserDetectionStatus](https://developer.apple.com/documentation/authenticationservices/asuserdetectionstatus). This claim is present only on iOS 14 and later, macOS 11 and later, watchOS 7 and later, tvOS 14 and later; the claim isn’t present or supported for web-based apps.

Will push a PR regarding this.

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.