a-tokyo / apple-signin-auth

 Apple signin for nodeJS.
MIT License
152 stars 35 forks source link

How to import this library to Ionic? #21

Closed Carsak closed 4 years ago

Carsak commented 4 years ago

Hello, thanks for library

I want to use this library in Ionic3, Angular based framework.

Steps:

  1. npm install --save apple-signin-auth
  2. import from node modules import appleSignIn from 'apple-signin-auth/lib';
  3. run code in component

    const options = {
      clientID: 'myClientId',
      redirectUri: 'http://someUrl',
      state: 'state',
      responseMode: 'form_post',
      scope: 'name email'
    };
    
    let url = appleSignIn(options);
    console.warn(url);

and get error

ERROR TypeError: __WEBPACK_IMPORTED_MODULE_6_apple_signin_auth_lib___default(...) is not a function

image

a-tokyo commented 4 years ago

Hey! @Carsak, I am not sure if the library would work with angular. However I think the import SHOULD work.

I will debug and fix the issue if any

a-tokyo commented 4 years ago

@Carsak I just noticed that there's a bug in the code snippet provided. The error says appleSignIn() is not a function, and it is not a function indeed.

Did you mean to use the code below?

appleSignIn.getClientSecret(options);

The available functions are:

{getAuthorizationUrl,getClientSecret,getAuthorizationToken,refreshAuthorizationToken,verifyIdToken,_getApplePublicKeys}

Please reopen the issue if it still persists after this fix (: