Plugin for authorization with Apple for Godot Game Engine
- Supports iOS deployment target
>= 10.0
- Supports Godot version
>= 3.3
- Supports simulator
-
Download Plugin for your version of Godot, unzip and copy files to your Godot project's
res://ios/plugins/godot_apple_auth
directory. -
You can find and activate plugin by going to Project -> Export... -> iOS and in the Options tab, scrolling to the Plugins section.
-
After exporting, you must add the capability to sign in with Apple in the xCode project.
- Methods
# Checking for support of the current Apple Sign-in platform
is_available() -> bool
# Check the status of authentication
credential() -> void
# Sign in with apple
sign_in() -> void
# Sign out with apple
sign_out() -> void
- Signals
credential(result: Dictionary)
authorization(result: Dictionary)
- Initialization
var godot_apple_auth: Object
func _ready():
if Engine.has_singleton("GodotAppleAuth"):
godot_apple_auth = Engine.get_singleton("GodotAppleAuth")
godot_apple_auth.connect("credential", self, "_on_credential")
godot_apple_auth.connect("authorization", self, "_on_authorization")
- Checking for support Apple Sign-in
# Call the method anywhere in the code
if godot_apple_auth.is_available():
print("available")
- Checking credential status
# 1. Call the method anywhere in the code
godot_apple_auth.credential()
# 2. Wait for the answer in the method below
func _on_credential(result: Dictionary):
if result.has("error"):
print(result.error)
else:
print(result.state)
# "authorized" <- user ID is in good state
# "not_found" <- user ID was not found
# "revoked" <- user ID was revoked by the user
- Sign In
# 1. Call the method anywhere in the code
godot_apple_auth.sign_in()
# 2. Wait for the answer in the method below
func _on_authorization(result: Dictionary):
if result.has("error"):
print(result.error)
else:
# Required
print(result.token)
print(result.user_id)
# Optional (can be empty)
print(result.email)
print(result.name)
- Sign Out
# Call the method anywhere in the code
godot_apple_auth.sign_out()
-
Just run
scripts/build.sh -v 3.3.4
where -v is desired Godot versionYou will find the ready-to-use archive with the plugin in the
bin
directory.