Closed wspl closed 3 years ago
Hey @wspl
We tested this package on Electron v9. What Electron version do you use?
Hey @wspl
We tested this package on Electron v9. What Electron version do you use?
Electron v11.
I found out that it may be due to we can't create napi object in objc callback. I commented out the following piece of code and it worked.
NSDictionary *result = [appleLogin initiateLoginProcess:^(NSDictionary * _Nonnull result) {
// Napi::Object obj = Napi::Object::New(env);
//
// for (NSString* key in result) {
// NSString *value = result[key];
//
// if(value != nil && [value length] > 0) {
// std::string napiKey = std::string([key UTF8String]);
// Napi::Value napiValue = Napi::Value::From(env, [[NSString stringWithFormat:@"%@", value] UTF8String]);
// obj.Set(napiKey, napiValue);
// }
// }
//
// deferred.Resolve(obj);
NSLog(@"%@", result);
} errorHandler:^(NSError * _Nonnull error) {
NSLog(@"%@", error);
// Napi::Object errorObj = Napi::Object::New(env);
//
// errorObj.Set("code", Napi::Value::From(env, error.code));
// errorObj.Set("message", Napi::Value::From(env, [error.description UTF8String]));
// for (NSString* key in error.userInfo) {
// NSString *value = error.userInfo[key];
// std::string napiKey = std::string([key UTF8String]);
// Napi::Value napiValue = Napi::Value::From(env, [[NSString stringWithFormat:@"%@", value] UTF8String]);
// errorObj.Set(napiKey, napiValue);
// }
//
// deferred.Reject(errorObj);
}];
Once I uncommented Napi::Object errorObj = Napi::Object::New(env);
, it crashed.
It looks like we can't access env obj or info obj from the objc callback
@wspl @jpalumickas
Hey, I am also trying to use this however I am receiving the following error:
Error Domain=com.apple.AuthenticationServices.AuthorizationError Code=1000 "(null)"
mac: 11.2.3 Node.js 12.14.1, Chromium 83.0.4103.122, and Electron 9.4.4.
I have not attempted to set up any Certificates, Keys, Profiles etc via Apple Developer.
@jmcrthrs
Make sure you have
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>
in entitlements and regenerate provisioning profile.
In provisioning profile you must include Sign with with Apple.
Also, Sign in with Apple only works in MAS (Mac app store) version, so you need to release app for testing or build MAS development version for testing with Development provisioning profile
@jpalumickas
Thanks for the extra information. I have never actually used a provisioning profile with my Electron app until now. I am able to build and sign the MAS app without any issues, however the Sign In does not work during development. e.g. running the app using
electron .
Is it required to add the embedded.provisionprofile
and entitlements
files inside the electron app inside node_modules/electron/dist/Electron.app/Contents
for this to work?
Version 0.5.0 released with this fix. Closing this issue, please reopen if this will not work for you.
@jmcrthrs
Yes, using electron .
will not work with Sign in with Apple. You need to build MAS Development
version if you want to test this. MAS development version has different entitlements and provisioning profiles. We use https://www.electronforge.io/ to build electron app, which helps little bit to handle that.
This exciting library is very useful for me, but my app crashing when I use this library.