-
-
Notifications
You must be signed in to change notification settings - Fork 197
fix: ability to publish iOS applications for users with two-factor authentication enabled #4903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
} | ||
|
||
if (result.isTwoFactorAuthenticationEnabled && opts && opts.ensureConsoleIsInteractive && !isInteractive()) { | ||
this.$errors.failWithoutHelp(`Your account has two-factor authentication enabled, but your console is not interactive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could mention the appleSessionBase64
option here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering the same and decided that mention tns publish ios --help
command and describing --appleSessionBase64
option in help, should be enough.
test cli-publish |
1 similar comment
test cli-publish |
Currently the users are not able to publish applications to AppStore if their accounts are with two-factor authentication enabled. The current PR introduces support for publishing iOS apps for accounts with two-factor authentication enabled and shouldn't affect how publish command works for accounts without two-factor authentication. To support it, we need 2 additional options:
The
--appleApplicationSpecificPassword
option is a password for user's Apple ID that let the user sign in to his account and securely access the information he stores from iTunes Transporter application. This option is mandatory for all accounts with two-factor authentication enabled. To generate an application specific password, follow the steps below:--appleApplicationSpecificPassword
option.The
--appleSessionBase64
option is a base 64 string that actually is the session cookie. This session will be reused instead of triggering a new login each time NativeScript CLI communicates with Apple's APIs.This PR introduces a new command
tns apple-login
as well.The
tns apple-login
command uses the provided credentials to obtain Apple session, encode the received session in base64 format and print it on console.How tns publish works?
NativeScript CLI tries to sign in the user with provided username and password. If the request fails with statusCode 409, NativeScript CLI consider this as an account with two-factor authentication enabled. If the account is with two-factor authentication, CLI prompts the user for the verification code.
Interactive console
--appleApplicationSpecificPassword
option is not provided, NativeScript CLI throws an error asiTunes Transporter
will not be able to upload the application.--appleApplicationSpecificPassword
option is provided:--appleSessionBase64
is provided, CLI decodes it and tries to sign in the user with provided session.--appleSessionBase64
is not provided, CLI will sign in the user with provided credentials.--appleApplicationSpecificPassword
option is not respected.--appleSessionBase64
is respected and NativeScript CLI reuse the provided session instead of triggering a new login.Non-interactive console (CI)
When the console is not interactive, NativeScript CLI doesn't prompt for verification code.
tns apple-login
and copy the printed sessiontns publish ios <username> <password> --appleApplicationSpecificPassword <app-specific-password> --appleSessionBase64 <session>
The session should be valid for about one month, meaning a new session should be generated every month. Usually the user will only know about it when the build starts failing.
Current behavior vs new behavior
Invalid username and password combination. Used '${username}' as the username.
PR Checklist
What is the current behavior?
What is the new behavior?
Rel to: #4586