electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.68k stars 1.74k forks source link

Failed to get authorization for username '***' on GitHub CI #7617

Open tbhaxor opened 1 year ago

tbhaxor commented 1 year ago
2023-06-16 18:47:40.641 *** Error: Notarization failed for '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/electron-notarize-UVgW1w/MyApp.zip'.
2023-06-16 18:47:40.641 *** Error: Unable to upload your app for notarization. Failed to get authorization for username '***' and password. (
    "Error Domain=NSCocoaErrorDomain Code=0 \"Status code: 0\" UserInfo={NSLocalizedDescription=Status code: 0, NSLocalizedFailureReason=The auth server returned a bad status code.}"
) (-1011)
 {
    NSLocalizedDescription = "Unable to upload your app for notarization.";
    NSLocalizedFailureReason = "Failed to get authorization for username '***' and password. (\n    \"Error Domain=NSCocoaErrorDomain Code=0 \\\"Status code: 0\\\" UserInfo={NSLocalizedDescription=Status code: 0, NSLocalizedFailureReason=The auth server returned a bad status code.}\"\n)";
}

I am getting error in github CI, this how I am setting environment in build script

...
env:
   APPLE_ID: ${{ secrets.APPLE_ID }}
...

There is OTP on the login screen on web, could that be a reason, if yes how can i fix it?

tbhaxor commented 1 year ago

This *** is for security reason from github CI. They redact PII. I checked with

console.log(process.env.APPLE_ID === "doe@john.com@") // true
mmaietta commented 1 year ago

Note: You MUST specify APPLE_ID and APPLE_APP_SPECIFIC_PASSWORD via environment variables to activate notarization step

https://www.electron.build/configuration/mac

tbhaxor commented 1 year ago

Note: You MUST specify APPLE_ID and APPLE_APP_SPECIFIC_PASSWORD via environment variables to activate notarization step

https://www.electron.build/configuration/mac

Can we re-open this, it is still not done on my end?

Do you want to use identifier in electron build file?

tbhaxor commented 1 year ago

Now getting error

Error: No authentication properties provided (e.g. appleId, appleApiKey)

Ladvace commented 2 months ago

I follow all the steps but I still get:

Error: No authentication properties provided (e.g. appleId, appleApiKey, keychain)

mmaietta commented 2 months ago

Sorry, this issue fell off my radar in my GH notifications list. This is the logic being used before calling the official npm electron/notarize package. Hopefully this helps describe further what env vars are needed to activate the notarization integration. https://github.com/electron-userland/electron-builder/blob/d5d9f3f9aaac0385cc943e30a0841669133afde8/packages/app-builder-lib/src/macPackager.ts#L532-L584

@Ladvace looks like your error may be coming from the electron/notarize package itself as I don't see that line logged anywhere in electron-builder. Can you please double-check the code linked above to make sure your env vars are set correctly? I'm wondering if we missed a verification edge case in the current notarization logic.

Ladvace commented 2 months ago

I think I probably called them in a different why, that's why, I'm gonna try renaming them asap:

APPLE_API_KEY APPLE_API_KEY_ID APPLE_API_ISSUER

Ladvace commented 2 months ago

actually another thing I got in before the error above is this one:

• skipped macOS notarization reason=notarizeoptions were unable to be generated

is this something related or can I ignore it? I'm currently using: electron-builder-notarize

Ladvace commented 2 months ago

@mmaietta I think I managed to do this, but for some reason now I'm getting this error:

 ⨯ Unexpected token 'E', "Error: The"... is not valid JSON  failedTask=build stackTrace=SyntaxError: Unexpected token 'E', "Error: The"... is not valid JSON
SyntaxError: Unexpected token 'E', "Error: The"... is not valid JSON
    at JSON.parse (<anonymous>)

those are the env I'm currently using:


APPLE_API_KEY_ID=MY_KEY
APPLE_API_ISSUER=MY_ISSUER_ID
APPLE_TEAM_ID=MY_TEAM_ID
APPLE_API_KEY=/Users/name/private_keys/AuthKey_MY_KEY.p8

PS: fixed following this: https://github.com/electron-userland/electron-builder/issues/8258

Ladvace commented 2 months ago

@mmaietta one problem I'm getting is, not sure why thi happens since I've set APPLE_API_ISSUER

Error: The appleApiIssuer property is required when using notarization with ASC credentials

Ladvace commented 2 months ago

managed to fix!, I think I didn't have to set notarize: true in the package.json since i'm using electron-builder-notarize