Coder Social home page Coder Social logo

twogate / cordova-plugin-sign-in-with-apple Goto Github PK

View Code? Open in Web Editor NEW
74.0 8.0 48.0 36 KB

A native-implemented plugin of Sign in with Apple // Thanks to your contribution! // Cordova>=8 iOS>=13

Home Page: https://www.npmjs.com/package/cordova-plugin-sign-in-with-apple

License: MIT License

JavaScript 55.05% Objective-C 44.95%
cordova sign-in-with-apple apple ios

cordova-plugin-sign-in-with-apple's Introduction

cordova-plugin-sign-in-with-apple

see also: Official Documentation

This plugin only supports iOS >= 13.

Installation

Plugin installation

cordova plugin add cordova-plugin-sign-in-with-apple

or

cordova plugin add https://github.com/twogate/cordova-plugin-sign-in-with-apple.git

Usage

You should enable Sign in with Apple capability in Xcode. (project file -> Capabilities Tab -> Turn on "SignIn With Apple")

window.cordova.plugins.SignInWithApple.signin(
  { requestedScopes: [0, 1] },
  function(succ){
    console.log(succ)
    alert(JSON.stringify(succ))
  },
  function(err){
    console.error(err)
    console.log(JSON.stringify(err))
  }
)

Options Example

  • requestedScopes is an array of requested scopes.
    • 0: FullName
    • 1: Email

Success Callback Data Example

Based on ASAuthorizationAppleIDCredential.

Failure Callback Data Example

  • error: string "ASAUTHORIZATION_ERROR"
  • code: string 1001
  • localizedDescription: string "The operation couldn’t be completed. (com.apple.AuthenticationServices.AuthorizationError error 1001.)"
  • localizedFailureReason: string ""

Error Type

cordova-plugin-sign-in-with-apple's People

Contributors

d-a-w avatar falcon8823 avatar keiya avatar mival avatar patrickbussmann avatar philippmayrth avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-plugin-sign-in-with-apple's Issues

ionic 5 ios build error

The following build commands failed:
CompileC /var/root/Library/Developer/Xcode/DerivedData/BBM-hbuovfudpynipvdknojfjjeuyrjr/Build/Intermediates.noindex/BBM.build/Release-iphonesimulator/BBM.build/Objects-normal/x86_64/SignInWithApple-17d9bcb48ed83d1ba769b5561ca25b9192ebbf1b16b380e5c6f8ba5f04145324.o /Users/macbookpro/Desktop/bbm-2/platforms/ios/BBM/Plugins/cordova-plugin-sign-in-with-apple/SignInWithApple.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
xcodebuild: Command failed with exit code 65

Invalid provider for the NgModule

I have imported SignInWithApple in app.module and it gives me error Invalid provider for the NgModule 'AppModule' - only instances of Provider and Type are allowed, got: [[object Object]]

The user email is shared only once

Hi, Is it normal that the user email is showed only on the first sign up?
...on the following logins it will be just and empty string.
Thanks

CordovaError: Promise rejected with non-error: 'Error code 65 for command: xcodebuild

Hi Guys,

recently we add this plugin with the following configuration:

  • cordova 9 or 8 ( tried both )
  • cordova-ios: 4.5.4

We satisfied all plugin dependencies. But per each build, we continue to receive the following extended error:

CordovaError: Promise rejected with non-error: 'Error code 65 for command: xcodebuild with args: -xcconfig,/Users/username/Documents/enterprise/mobile/projectSubFolder-wrapper/projectSubFolder/jera.goweb.mobile.projectSubFolder/COMPANY_projectSubFolder_APP/projectSubFolder/appbuilds/compiled/DEVELOPMENT/GOprojectSubFolder.50.50.50/ios/com.project.name.custom.ch20/platforms/ios/cordova/build-debug.xcconfig,-workspace,com.project.name.custom.ch20.xcworkspace,-scheme,com.project.name.custom.ch20,-configuration,Debug,-destination,generic/platform=iOS,-archivePath,com.project.name.custom.ch20.xcarchive,archive,CONFIGURATION_BUILD_DIR=/Users/username/Documents/enterprise/mobile/projectSubFolder-wrapper/projectSubFolder/jera.goweb.mobile.projectSubFolder/COMPANY_projectSubFolder_APP/projectSubFolder/appbuilds/compiled/DEVELOPMENT/GOprojectSubFolder.50.50.50/ios/com.project.name.custom.ch20/platforms/ios/build/device,SHARED_PRECOMPS_DIR=/Users/username/Documents/enterprise/mobile/projectSubFolder-wrapper/projectSubFolder/jera.goweb.mobile.projectSubFolder/COMPANY_projectSubFolder_APP/projectSubFolder/appbuilds/compiled/DEVELOPMENT/GOprojectSubFolder.50.50.50/ios/com.project.name.custom.ch20/platforms/ios/build/sharedpch,-UseModernBuildSystem=0'


[exec] ** ARCHIVE FAILED **
[exec]
[exec]
[exec] The following build commands failed:
[exec] CompileC /Users/username/Library/Developer/Xcode/DerivedData/com.project.name.custom.ch20-aqojepblusoqpdhfxyksgwhjbgzt/Build/Intermediates.noindex/ArchiveIntermediates/com.project.name.custom.ch20/IntermediateBuildFilesPath/com.project.name.custom.ch20.build/Debug-iphoneos/com.project.name.custom.ch20.build/Objects-normal/armv7/SignInWithApple-509AF0B801A9C281.o com.project.name.custom.ch20/Plugins/cordova-plugin-sign-in-with-apple/SignInWithApple.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler

Has someone the same problem or some suggestions about the environment to use?

EDIT:
If we comment on the plugin inside config.xml, build is successful.

Many thanks

Simon

Need iOS 12 support

iOS 13 is available on iPhone 6s or later (including iPhone SE). That means both iPhone 5S and iPhone 6 don't make the list and are forever stuck with iOS 12.4.1.

iPhone 5S and iPhone 6 devices still exist in the market and lot of users are using it hence we cannot neglect these devices.

IOS 14 login Issue

Hi

I installed the plugin in my simulator IOS 14.2, but appear that while it try to login is stuck with password.

I have checked it in iOS 13.3 and work fine.

fullName Object not full

When selecting to sign in with the email, the object of fullName is empty as well as email, while everything else is full. Using Cordova 5.1.1, IOS 13.4

Double popup on auth

After clicking on the auto-sign icon, the Safari browser opens, and 2 pop-ups for entering a password (or FaceID) pop up there. First opens the correct one, on top of it opens with the application name null. When you enter a password in each of them, the browser remains open. You have to manually go to the application. As a result, authorization error {" code ":" 1000 "," localizedFailureReason ":" "," error ":" ASAUTHORIZATION_ERROR "," localizedDescription ":" The operation couldn't be completed. (Com.apple.AuthenticationServices.AuthorizationError error 1000.) "}
When entering a password only in the required popup, the error is the same

Native popup doesn't show up with Ionic 3

Working on ionic 3 project.

cordova -v
9.0.0 (cordova-lib@9.0.1)

First there was an error about not recognizing your code. Same as here.
After changing your code like

export declare class ASAuthorizationAppleIDRequest {
    // static readonly ASAuthorizationScopeFullName = 0;
    // static readonly ASAuthorizationScopeEmail = 1;
    requestedScopes?: number[];
}

and give requestedScopes with numbers like

...signin({requestedScopes: [0, 1]})

that error wasn't there anymore. But also nothing happening. Can not get in your plugins scope. Therefore popup doesnt show up.

Class not found error when attempting login with apple id on android

Hello,

I am using this plugin for a Ionic 3 project and i followed the instructions provided in the readme and everything is working great on IOS.

When attempting to use it on Android, the error callback is called for the signin method with this string error: "Class not found".

Does this plugin only support IOS? If yes, are there any plans to expand to suporting Android as well?
If it also suports Android already, are there any additional steps needed to be taken in order for it to work?

Thanks for your work on the plugin!

Cannot pass nonce and state in signin options

The signin method is defined as signin(options?: ASAuthorizationAppleIDRequest): Promise<AppleSignInResponse>;

The documentation of ASAuthorizationAppleIDRequest states that a nonce and a state string property can be passed. However the code at SignInWithApple.m does not seem to pass the two properties to the native method.

It would be nice if nonce and state could be passed. Especially supporting nonce would be great since that is included in the JWT.

unable to use in PGB

i get an error on build.
no type or protocol named 'ASAuthorizationScope

SignInWithApple.m:14:12: error: no type or protocol named 'ASAuthorizationScope'

  • (NSArray *)convertScopes: (NSArray<NSNumber *> *)scopes
    ^
    /project/MyClub/Plugins/cordova-plugin-sign-in-with-apple/SignInWithApple.m:27:4: error: expected a type
  • (ASAuthorizationScope)convertScope: (NSNumber *)scope

can anyone help

Result fullName empty

I am using the simple example...

window.cordova.plugins.SignInWithApple.signin(
{ requestedScopes: [0, 1] },
function(succ){
console.log(succ)
alert(JSON.stringify(succ))
},
function(err){
console.error(err)
console.log(JSON.stringify(err))
}
)

The code above give me just the "authorizationCode" , "identityToken" and "user", but I need the "fullName" and this is empty.

The results of my console log
"Screen Shot 2021-11-11 at 10 02 08"

info device
Iphone 11 pro - iOS 15.1

version Cordova 10.0.0
version plugin 0.1.2

Why is the "fullName" empty?
Could anybody help me?

Invalid signature

Hi,

When I use the plugin I correctly get the user id and id token etc. However, when I parse the token here: https://jwt.io, I always get an 'Invalid signature' error, although the claims in the JWT are correct. Any idea what could be wrong?

SignIn after manual revocation does not use scopes

I am having an issue (testing with iOS 16 on a Simulator, I don't know about other versions).

  • I do a SignIn with email & name scopes [0, 1] and ask to use anonymous email.
  • I validate the SignIn in the server side with https://appleid.apple.com/auth/token
  • Then I sign out from my App and do a manual revocation: Settings->Apple Id Profile->Password & Security->Apps Using Apple ID->Stop using Apple ID
  • Then I try to SignIn again using the same procedure (scopes [0, 1]) but this second time the dialog only asks about starting a new session and does not show options about Name or Email.
  • In the success callback I don't get email, name or anything else.

I'm doing manual token revocation as a first step before implementing programatic revocations (https://appleid.apple.com/auth/revoke). I'm not sure yet whether programatic revocations may fix the issue. I don't think it will but I will give it a try.

After a few hours something is reset and then it works again. So this may be some problem with Apple?

I've read about similar problems here: capacitor-community/apple-sign-in#44 and here invertase/react-native-apple-authentication#282 (comment)

Cannot get email & name while scopes requested on IOS14

it works fine previously where users get to give permission to plugin for email and fullname,
this.signInWithApple.signin({ requestedScopes: [ ASAuthorizationAppleIDRequest.ASAuthorizationScopeFullName, ASAuthorizationAppleIDRequest.ASAuthorizationScopeEmail ] })
but now, when sign in using apple, the request permission page is gone, and it just sign in using a masked email

Cordova 8.1.2

Is there a way to install or modify this plugin under 8.1.2?
Cordova 9 has a lot of bugs and I can't work with it yet.

Authorization failed

I have new issue i haven't before. When I try to "sign in with apple" i catch error [core] Authorization failed: Error Domain=AKAuthenticationError Code=-7034 "(null)" UserInfo={AKClientBundleID=xxxxx}. Before all worked great with the same settings (capability "sign in with apple" included). I test this issue on real and simulator devices. I can't find anything about "7034" error code.

Infinite Loading with Ios Emulator

Hi, I don't have a physical ios device so I always use emulator with xcode to debug my code.
I've turn on "SignIn With Apple" inside capabilities in Xcode and I write the demo code in my app:

window.cordova.plugins.SignInWithApple.signin(
  { requestedScopes: [0, 1] },
  function(succ){
    console.log(succ)
    alert(JSON.stringify(succ))
  },
  function(err){
    console.error(err)
    console.log(JSON.stringify(err))
  }
)

If I tried to login with Apple Account the first two steps works good, but the third one after I insert the password remain in infinite loop loading. I don't find anything in the documentation. What could be the problem?
1
2
3

Apple login passcode screen UI Issue

I have integrated apple login, it was working fine till last week. Now I got error design of passcode in iphone XR. The passcode design is not visible, so we are not able to enter passcode. Kindly refer below screen. Anyone help me how to resolve this issue?

image_2020_08_12T09_07_22_664Z

utilities is not defined in after_prepare

Hi,
there is an error during cordova compilation due a reference error in after_prepare.js

   While preparing Cordova project for platform iOS:
   ReferenceError: utilities is not defined
   at module.exports
/XXXX/cordova-build/plugins/cordova-plugin-sign-in-with-apple/scripts/after_prepare.js:12:42

It seems that utilities is undefined.

Login don't work on simulator iOS14

Hello! I've noticed that my app login stopped working since the iOS14 update on every simulator on my mac.
I put my password and it just (looks like) loading but nothing happens. On an physical iPhone it works flawlessly.

I've tried removing both account and device in the dev panel and double checked the permssions. Another think I've noticed is if I insert a wrong password I get a classic error so the server is doing something.
Could it be something apple side?

Apple rejects app

Hello Apple just rejected the app because I ask the user after login to enter date of birth and gender. I need these data in the very first step. Is there any way to pick gender and d.o.b. from apple login? the plugin doesn't seem to have thia capability. Thank you

login success? but no info, no email or user name, just token

Installed the plugin with no errors and configured the backend, certificates etc. After sign in with Apple, I am getting an object with these properties: email, state, identityToken, fullName, user. However the email, state and fullName properties are empty. Only an identity token is provided.

Shouldn't there be some email address - whether one from apple or the user's , and some name?

email: ""
fullName: {nickname: "", phoneticRepresentation: {}, familyName: "", namePrefix: "", givenName: "", …}
identityToken: "eyJraWQiOiJBSURPUEsxIiwiYWxnIjoiUlMyNTYifQ.eyJpc3MiOiJodHRwczovL2FwcGxlaWQuYXBwbGUuY29tIiwiYXVkIjoiY29tLnBldHRpbmdjbHViLmFwcCIsImV4cCI6MTU3M…"

Plugin not loading on Phonegap Build

I have added the plugin to my config.xml

<plugin name="cordova-plugin-sign-in-with-apple" source="npm"/>

and I'm using PhoneGap version cli-9.0.0

<preference name="phonegap-version" value="cli-9.0.0" />

Whenever I call the plugin code window.cordova.plugins.SignInWithApple.signin(...) I get Uncaught TypeError: Cannot read property 'signin' of undefined

I tried to delete the project and recreating it on Phonegap build, and I get the same error
Note: I'm debugging it on iPhone 13.x.x

Make the plugin automatically add the capability

"You should enable Sign in with Apple capability in Xcode"

No, I should expect a fully configured product when I run cordova build --release. Why would you make people go into Xcode every time they want a build?

I've spent hours figuring out why sign in didn't work on TestFlight, and am logging this issue in great frustration.

Requested scope doesn't seem to do anything

I'm testing an app on iOS 13, and I've set the requested scope to [0, 1]. It doesn't seem to do anything. Apple sign in does not offer an option to provide the email, and the email is therefore never obtained.

Stuck on verify password modal

I have type the correct password but it still loading when i press continue. Then, i've got nothing, the screen stuck on verify password screen with continue button enabled. Please help me 😭

Different identityToken for every login

Each time you logout - then login using same apple account, it returns different identityToken, which is a very big issue because it resulted in multiple creation of accounts in the backend

TypeError: Object(...) is not a function at SignInWithAppleOriginal.signin

When i try to log in with apple, i get that error.
My code:

async loginWithApple(): Promise<void> {
    
    try {
      const appleCredential: AppleSignInResponse = await SignInWithApple.signin({
        requestedScopes: [
          ASAuthorizationAppleIDRequest.ASAuthorizationScopeFullName,
          ASAuthorizationAppleIDRequest.ASAuthorizationScopeEmail
        ]
      });

      console.log({ appleCredential });

      alert(JSON.stringify(appleCredential))


    } catch (error) {
      console.log(error);
    }
    
  }

Authorization failed - Error 1000

When I try to use the login I get an error 1000. I have configured the sign in with apple capability, do you have any idea that another action could generate this problem?

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.