Platforms to show: All Mac Windows Linux Cross-Platform
/MacFrameworks/Sign in with Apple/Password Query
Last modified Sat, 27th Jun 2025.
You find this example project in your MBS Xojo Plugin download as a Xojo project file within the examples folder: /MacFrameworks/Sign in with Apple/Password Query
Download this example: Password Query.zip
Project "Password Query.xojo_binary_project"
Class App Inherits DesktopApplication
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Opening()
End EventHandler
End Class
Class mainWindow Inherits DesktopWindow
Control List Inherits DesktopListBox
ControlInstance List Inherits DesktopListBox
End Control
Control Button1 Inherits DesktopButton
ControlInstance Button1 Inherits DesktopButton
EventHandler Sub Pressed()
SignIn
End EventHandler
End Control
Sub Log(s as string)
List.AddRow s
End Sub
Sub SignIn()
Log "try sign in"
If Not ASAuthorizationController.HasEntitlement("com.apple.developer.associated-domains") Then
Log "Your application misses the com.apple.developer.associated-domains entitlement."
End If
// see also https://developer.apple.com/documentation/xcode/supporting-associated-domains
Var provider As New ASAuthorizationPasswordProviderMBS
// we create the request
var request as ASAuthorizationPasswordRequestMBS = provider.createRequest
// create our controller
controller = New ASAuthorizationController(array(request))
// set context window for dialog
controller.presentationContext = Self
// and show dialog now
controller.performRequests
End Sub
Property controller As ASAuthorizationController
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
MenuItem WindowMenu = "Window"
MenuItem HelpMenu = "&Help"
End MenuBar
Sign
End Sign
Class ASAuthorizationController Inherits ASAuthorizationControllerMBS
EventHandler Sub didCompleteWithAuthorization(authorization as ASAuthorizationMBS)
Log CurrentMethodName
Log "authorization: "+authorization.Description
Var v As Variant = authorization.Credential
If v IsA ASPasswordCredentialMBS Then
Var c As ASAuthorizationAppleIDCredentialMBS = v
Log "credentials: "+c.Description
Log "User: "+c.User
Log "Email: "+c.Email
ElseIf v IsA ASAuthorizationCredentialMBS Then
Var c As ASAuthorizationCredentialMBS = v
log "credentials: "+c.Description
End If
End EventHandler
EventHandler Sub didCompleteWithError(error as NSErrorMBS)
Log CurrentMethodName
If error <> Nil Then
log error.LocalizedDescription
End If
End EventHandler
Sub Log(s as string)
mainWindow.Log s
End Sub
End Class
End Project
See also:
- /MacFrameworks/Sign in with Apple/Sign In with Apple iOS
- /MacFrameworks/Sign in with Apple/Sign In with Apple Mac
Download this example: Password Query.zip
The items on this page are in the following plugins: MBS MacFrameworks Plugin.