question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

[Help] Example of Apple SignIn implementation with POST_FORM

See original GitHub issue

Hi šŸ˜„ ,

Iā€™ve would like to implement Apple SignIn authentication with Grant + Purest, but Iā€™m unable to find great configuration with Purest (not update since 4 years with latest providers like ā€˜Appleā€™)

Grant is unable to read POST_FORM access_token and itā€™s return oAuth2 missing code parameter error.

Grant config (not sure about this)

 apple: {
      key: '', // reverse.domain.name
      secret: '', // Need to be refer with "Generate client secret" 
      callback: `[domain.name]/auth/apple/callback`,
      nonce: true,
      state: true,
      scope: ['name', 'email'],
      custom_params: {
        response_type: 'code id_token',
        response_mode: 'form_post' // necessary... Apple constrain šŸ˜¢ 
      },
    },

Purest configuration testing :

const apple = purest({
        provider: 'apple',
        config: {
          apple: {
            'https://appleid.apple.com': {
              __domain: {
                auth: {
                  auth: { bearer: '[0]' },
                },
              },
              '{endpoint}': {
                __path: {
                  alias: '__default',
                },
              },
            },
          },
        }
      });

apple
        .query()
        .post('auth/token') // not sure about this ? apple want post request only
        .auth(access_token)
        .request((err, res, body) => {  
              if (err) {
                   callback(err);
              } else {
                  // let do some stuff...
                  callback(null, {body});
              }
        });

Iā€™ve successfully sign in with other libraries (apple-signin and apple-auth) but I would like to perform signIn request only with Grant + Purest and not implement a tierce package. But Grant return the same error with the access_token (code for Apple) and itā€™s unable to return and read it from POST_FORM request.

The project ā€œPlaygroundā€ implement Apple SignIn testing example, but I canā€™t find any code to understand how itā€™s working. Apple documentation is clearlyā€¦ pitiable.

Thanks for your help !

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:33 (16 by maintainers)

github_iconTop GitHub Comments

2reactions
rxbcommented, May 7, 2021

Not sure if this will be useful to your use case @forgot or maybe others who find their way to this thread, but I threw together a short guide to using Apple Oauth with FeathersJS. I had a lot of misconceptions going into it, but once I got myself sorted out, this is what I ended up with: https://gist.github.com/rxb/e596c66b03e3262f26d9ede5d7dbab81

1reaction
simovcommented, May 16, 2021

The fix for the user profile was published in v5.4.14

Read more comments on GitHub >

github_iconTop Results From Across the Web

Implementing User Authentication with Sign in with Apple
This sample app, Juice, uses the Authentication Services framework to provide users an interface to set up accounts and sign in with their...
Read more >
Sign in with Apple Tutorial, Part 4: Web and Other Platforms
Click the Configure button next to Sign in with Apple. This is where you define the domain your app is running and redirect...
Read more >
Authenticate Using Apple | Firebase - Google
On this page Ā· Before you begin. Join the Apple Developer Program; Configure Sign In with Apple; Enable Apple as a sign-in provider...
Read more >
How to Add Sign in with Apple to iOS Apps - Auth0
Using Auth0 to Integrate iOS Apps with Apple Ā· Project Name: Type something meaningful, like "SIWA Native". Ā· Team: Choose your Apple Developer...
Read more >
Sign in With Apple implementation tutorial
Prerequisite Ā· Enable Sign-in with Apple in App Identifier Ā· Enable Sign-in with Apple capability in Xcode Ā· Setting up SIWA button UI...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found