({{, (RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog])[] 
initiates a standard dialog for entering username/password authentication information.}, {, (RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog])["type"]
initiates an authentication dialog of the specified standard type.}, {, (RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog])[{"(Subscript[key, 1])","(Subscript[key, 2])", …}]
initiates an authentication dialog that requests values for the specified keys.}, {, (RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog])[arg,func]
applies the function func to the dialog's return value.}})

OpenersNotesSection(Spacer1)Details and Options

Possible values for type include:

(RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog])[] displays a dialog of type "UsernamePassword".

(RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog])[arg] is equivalent to (RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog])[arg,(RefLink[Identity, paclet:ref/Identity])].

Password fields automatically use (RefLink[FieldMasked, paclet:ref/FieldMasked]) to mask their contents in the dialog display.

If the user cancels the dialog, (RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog]) returns (RefLink[$Canceled, paclet:ref/$Canceled]), even if a function func is specified.

(RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog])["PermissionsKey"] returns a (RefLink[PermissionsKey, paclet:ref/PermissionsKey]) expression.

(RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog])["SecuredAuthenticationKey"] returns a (RefLink[SecuredAuthenticationKey, paclet:ref/SecuredAuthenticationKey]) expression.

All other dialog types return an (RefLink[Association, paclet:ref/Association]).

The Wolfram Language kernel in which (RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog]) is evaluated will block until the dialog is finished.

When no front end is present, (RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog]) writes to standard output and reads from standard input.

The forms (RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog])["type"->{"(Subscript[key, 1])"->"(Subscript[init, 1])",…}] and (RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog])[{"(Subscript[key, 1])"->"(Subscript[init, 1])",…}] can be used to specify initial values for any of the fields.

The content of a field specified as "(Subscript[key, 1])"->"(Subscript[init, 1])"->"Masked" will be masked.

(RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog])[(RefLink[FormObject, paclet:ref/FormObject])[…]] is also supported on some platforms, to display an arbitrary form in the dialog.

(RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog]) accepts notebook options and (RefLink[AppearanceRules, paclet:ref/AppearanceRules]).

(RefLink[AppearanceRules, paclet:ref/AppearanceRules]) can be used to specify the overall appearance of the dialog, including a title and descriptive text.

(RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog]) by default puts up a dialog in the middle of the main display screen. Explicit settings for (RefLink[WindowMargins, paclet:ref/WindowMargins]) override this.

OpenersPrimaryExamplesSection(Spacer1)Examples  (19)

OpenersExampleSection0(Spacer1)Basic Examples  (4)

Request a username and password:

AuthenticationDialog[]

Request just a password:

AuthenticationDialog["Password"]

Request just a password and automatically process the result:

AuthenticationDialog["Password", Hash[#Password]&]

Request secured authentication credentials:

AuthenticationDialog["SecuredAuthenticationKey", AppearanceRules-><|"Description" -> "Please enter your OAuth information for that service."|>]

OpenersExampleSection1(Spacer1)Scope  (6)

Provide initial values for some of the dialog fields:

AuthenticationDialog["UsernamePassword" -> {"Username" -> "matt"}]

Specify a function to process the resulting (RefLink[Association, paclet:ref/Association]):

AuthenticationDialog[{"Username" -> "matt", "Password", "Password hint" -> "first pet's name"}, Delete[#, "Password hint"]&]

Use custom key names, specifying optional initial values and masking:

AuthenticationDialog[{"Public key", "Private key" -> "12345" -> "Masked"}]

Use (RefLink[FormObject, paclet:ref/FormObject]) for other control types, optional fields, and so on:

AuthenticationDialog[FormObject[{"Username"->"String","Password"-><|"Masked"->True|>,"Password hint"-><|"Required"->False,"Hint"->"(optional)"|>,"Remember me"->"Boolean"}]]

Use (RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog]) in a standalone Wolfram Language kernel:

$ ./WolframKernel
Mathematica 11.3.0 Kernel for Mac OS X x86 (64-bit)
Copyright 1988-2017 Wolfram Research, Inc.

In[1]:= AuthenticationDialog[]                                                            
Username: matt                                                                            
Password: *****                                                                           

Out[1]= <|Username -> matt, Password -> 12345|>

Use (RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog]) in wolframscript:

$ wolframscript -code "AuthenticationDialog[]"
Username: matt
Password: *****
<|Username -> matt, Password -> 12345|>

$

OpenersExampleSection2(Spacer1)Options  (5)

OpenersExampleSubsection0(Spacer1)AppearanceRules  (3)

Include descriptive text in the dialog:

AuthenticationDialog[ "UsernamePassword", AppearanceRules->{"Description" -> "That service requires you to log in."}]

Specify a title and a description:

AuthenticationDialog[{"Username", "Password","Comments"},AppearanceRules -> {"Title" -> "Please login","Description" -> "That service requires you to log in."}]

Change the text on the submit button:

AuthenticationDialog["PermissionsKey",AppearanceRules -> {"SubmitLabel" -> "Continue"}]

OpenersExampleSubsection1(Spacer1)WindowMargins  (1)

Position the dialog at the upper-left corner of the main display:

AuthenticationDialog["PermissionsKey", WindowMargins -> {{0,Automatic},{Automatic,0}}]

OpenersExampleSubsection2(Spacer1)WindowTitle  (1)

Use (RefLink[WindowTitle, paclet:ref/WindowTitle]) and other notebook options to adjust aspects of the dialog's notebook window:

AuthenticationDialog["UsernamePassword",WindowTitle -> "Authentication Required",
WindowSize -> {350,FitAll},
WindowFrameElements -> {"CloseBox","ResizeArea"},
WindowElements -> {"MagnificationPopUp","HorizontalScrollBar","VerticalScrollBar"},
AppearanceRules -> <|"Description" -> TextGrid[{{"You are attempting to read from the url:"}, {Item[Hyperlink["https://..."], Alignment -> Center]}, {"and the server is requesting authentication. These values will be kept for this session only."}},BaseStyle -> "FormDescription"],
"SubmitLabel" -> "Log in"|>]

OpenersExampleSection3(Spacer1)Properties & Relations  (2)

Use (RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog]) as a setting for (RefLink[Authentication, paclet:ref/Authentication]), to prompt for credentials when needed:

URLRead["https://www.wolframcloud.com/objects/d1362db4-d2b4-492e-bc60-090170c44d22","Content",Authentication->AuthenticationDialog["PermissionsKey"]]

Use (RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog]) to request a password for other functions, like (RefLink[Encrypt, paclet:ref/Encrypt]) and (RefLink[Decrypt, paclet:ref/Decrypt]):

Encrypt[AuthenticationDialog["Password",#Password&],"my data"]

Decrypt[AuthenticationDialog["Password",#Password&],%]

OpenersExampleSection4(Spacer1)Possible Issues  (2)

Preemptive controls cannot block the kernel's evaluation queue:

Button["Authenticate…", AuthenticationDialog[]]

Always call (RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog]) from a queued evaluation:

Button["Authenticate…", AuthenticationDialog[], Method -> "Queued"]

(RefLink[AuthenticationDialog, paclet:ref/AuthenticationDialog]) blocks the kernel's evaluation queue, preventing asynchronous dynamics from rendering:

myDescription[] := Style["That service requires you to log in.","FormDescription"];
AuthenticationDialog["Password",AppearanceRules->{"Description" -> Dynamic[myDescription[],SynchronousUpdating->False]}]

Only synchronous dynamics will render while the kernel's evaluation queue is blocked:

AuthenticationDialog["Password",AppearanceRules->{"Description" -> Dynamic[myDescription[]]}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Authentication, paclet:ref/Authentication])  ▪  (RefLink[PermissionsKey, paclet:ref/PermissionsKey])  ▪  (RefLink[SecuredAuthenticationKey, paclet:ref/SecuredAuthenticationKey])  ▪  (RefLink[DialogInput, paclet:ref/DialogInput])  ▪  (RefLink[Encrypt, paclet:ref/Encrypt])  ▪  (RefLink[FieldMasked, paclet:ref/FieldMasked])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Dialog Boxes, paclet:guide/DialogBoxes])}, {▪(RefLinkPlain[Cloud Permissions Control, paclet:guide/CloudPermissionsControl])}, {▪(RefLinkPlain[Web Operations, paclet:guide/WebOperations])}, {▪(RefLinkPlain[URL Manipulation, paclet:guide/URLManipulation])}, {▪(RefLinkPlain[HTTP Requests & Responses, paclet:guide/HTTPRequestsAndResponses])}, {▪(RefLinkPlain[Setting Up User Interactions, paclet:guide/SettingUpUserInteractions])}})}})