Android plugin for Godot that uses One Tap API for login.
- Download AAR library for Android https://godotengine.org/download
- Rename AAR library to godot-lib.release.aar and place it in Plugin-source/app/libs
- Open Plugin-source folder in Android Studio
- Click on Build -> Make Project
Compiled plugin will be in Plugin folder and also copied in Demo project.
- Compile Plugin
- Open Demo/project.godot in Godot 4
- Create web client id following Set up your Google APIs console project
note: App's package name is org.godotengine.onetapdemo - Set your web client id in Main.gd
- Download and install Android Build Template from Project menu
- setWebClientID(webClientId: String)
- Set this function before calling any other. For web client ID follow https://developers.google.com/identity/one-tap/android/get-started#api-console
- signIn(authorizedAccounts: Boolean, autoSelect: Boolean)
- authorizedAccounts:
- Sets whether to only allow the user to select from Google accounts that are already authorized to sign in to your application. If true, the user will not be able to select any Google account that would otherwise require explicit authorization to share basic profile/email data with your application. This may reduce some friction in the sign-in user journey, and guarantees that the returned credential is for a "returning user", but limits the user's freedom to choose among all the Google accounts on the device
- autoSelect:
- Sets the auto-select behavior in the request. For users who opt-in, Auto Select allows a credential to be selected automatically without waiting for a user action (such as tapping on the "continue" button). A credential can be auto selected if 1) only one credential can be used for sign-in; and 2) no further actions need to be taken for this credential (for example, data sharing permissions are already collected for a Google account).
- signOut()
- Signs out
- on_success(data:Dictionary)
- When the login succeeds, it returns dictionary data(fields could be null):
data.id
data.displayName
data.givenName
data.familyName
data.profilePictureUri
data.password
data.googleIdToken
data.phoneNumber - on_error(error:Dictionary)
- Returns error code and message.
error.code
error.message