{"id":15987358,"url":"https://github.com/andraxdev/teslasoft-id-client","last_synced_at":"2025-10-20T22:30:36.031Z","repository":{"id":65517851,"uuid":"593834859","full_name":"AndraxDev/teslasoft-id-client","owner":"AndraxDev","description":"This library enable you to authenticate users through Teslasoft ID","archived":true,"fork":false,"pushed_at":"2024-04-25T00:31:51.000Z","size":4864,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-06T01:36:51.253Z","etag":null,"topics":["android-library","kotlin","mobile"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AndraxDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-26T23:55:19.000Z","updated_at":"2024-08-17T23:40:17.000Z","dependencies_parsed_at":"2025-02-11T17:46:20.221Z","dependency_job_id":null,"html_url":"https://github.com/AndraxDev/teslasoft-id-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AndraxDev/teslasoft-id-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndraxDev%2Fteslasoft-id-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndraxDev%2Fteslasoft-id-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndraxDev%2Fteslasoft-id-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndraxDev%2Fteslasoft-id-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndraxDev","download_url":"https://codeload.github.com/AndraxDev/teslasoft-id-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndraxDev%2Fteslasoft-id-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280171265,"owners_count":26284618,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-20T02:00:06.978Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android-library","kotlin","mobile"],"created_at":"2024-10-08T03:23:03.960Z","updated_at":"2025-10-20T22:30:35.671Z","avatar_url":"https://github.com/AndraxDev.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Teslasoft ID client\r\nThis library enable you to authenticate users through Teslasoft ID. \r\nAlso this library can help you to personalize user experience by saving app's settings into \r\nTeslasoft ID account and syncing it between multiple devices.\r\n\r\n## Installation\r\n\r\nAdd the following line to your build.gradle:\r\n\r\n```gradle\r\nimplementation 'org.teslasoft.core.auth:teslasoft-id:1.1.0'\r\n```\r\n\r\nOr add the following dependency if you are using Maven:\r\n\r\n```xml\r\n\u003cdependency\u003e\r\n    \u003cgroupId\u003eorg.teslasoft.core.auth\u003c/groupId\u003e\r\n    \u003cartifactId\u003eteslasoft-id\u003c/artifactId\u003e\r\n    \u003cversion\u003e1.1.0\u003c/version\u003e\r\n    \u003ctype\u003eaar\u003c/type\u003e\r\n\u003c/dependency\u003e\r\n```\r\n\r\n## Usage\r\n\r\n### Teslasoft ID button\r\n\r\nAdd the following code to your layout:\r\n\r\n```xml\r\n...\r\n\u003candroidx.fragment.app.FragmentContainerView\r\n        android:id=\"@+id/teslasoft_id_btn\"\r\n        android:name=\"org.teslasoft.core.auth.widget.TeslasoftIDButton\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        tools:layout=\"@layout/widget_teslasoft_id\" \r\n        ... other params ...\r\n        /\u003e\r\n...\r\n```\r\n\r\nCircluar button:\r\n\r\n```xml\r\n...\r\n\u003candroidx.fragment.app.FragmentContainerView\r\n        android:id=\"@+id/teslasoft_id_btn\"\r\n        android:name=\"org.teslasoft.core.auth.widget.TeslasoftIDCircledButton\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        tools:layout=\"@layout/widget_teslasoft_id_circle\" \r\n        ... other params ...\r\n        /\u003e\r\n...\r\n```\r\n\r\n\u003e **Warning**\r\n\u003e\r\n\u003e Do not use both buttons on the same Activity/Fragment. It will break account sync.\r\n\r\nAdd the following code to your Activity/Fragment:\r\n\r\n```kotlin\r\nprivate var teslasoftIDButton: TeslasoftIDButton? = null\r\n\r\nprivate val accountDataListener: AccountSyncListener = object :\r\n    AccountSyncListener {\r\n    \r\n    /**\r\n     * onAuthFinished triggers when authentication was successful.\r\n     *\r\n     * @param name First and last name of the account.\r\n     * @param email Email of the account.\r\n     * @param isDev Determines if user a developer. Can be used to deliver beta features.\r\n     * @param token An auth token. Use it to sync settings and perform actions in your account.\r\n     * */\r\n    override fun onAuthFinished(name: String, email: String, isDev: Boolean, token: String) { \r\n        /* Auth finished */\r\n        \r\n        ...\r\n        \r\n        runOnUiThread {\r\n            /* Work with UI elements here otherwise an Exception will be raised */\r\n        }\r\n    }\r\n\r\n    /**\r\n     * onAuthCanceled triggers when user dismissed account picker dialog without selecting any options.\r\n     * */\r\n    override fun onAuthCanceled() { \r\n        /* Auth canceled */ \r\n        \r\n        ...\r\n        \r\n        runOnUiThread {\r\n            /* Work with UI elements here otherwise an Exception will be raised */\r\n        }\r\n    }\r\n\r\n    /**\r\n     * onSignedOut triggers when user clicked \"Turn off sync\" button or user session has expired.\r\n     * */\r\n    override fun onSignedOut() { \r\n        /* User signed out */\r\n        \r\n        ...\r\n        \r\n        runOnUiThread {\r\n            /* Work with UI elements here otherwise an Exception will be raised */\r\n        }\r\n    }\r\n\r\n    /**\r\n     * onAuthFailed triggers when internal error is occurred. (ex. Teslasoft Core is not installed, no Internet connection\r\n     * or account database is corrupted).\r\n     *\r\n     * @param state Reason of failure.\r\n     * @param message Error message. Please use android string instead od this message. Android strings can be translated to other languages.\r\n     * This message is for developers only.\r\n     * */\r\n    override fun onAuthFailed(state: String, message: String) { \r\n        /* Auth failed */\r\n        \r\n        ...\r\n        \r\n        runOnUiThread {\r\n            /* Work with UI elements here otherwise an Exception will be raised */\r\n        }\r\n    }\r\n}\r\n\r\n...\r\noverride fun onCreate(savedInstanceState: Bundle?) {\r\n    super.onCreate(savedInstanceState)\r\n        \r\n    teslasoftIDButton = supportFragmentManager.findFragmentById(R.id.teslasoft_id_btn) as TeslasoftIDButton\r\n    if (teslasoftIDButton != null) teslasoftIDButton?.setAccountSyncListener(accountDataListener)\r\n    ...\r\n}\r\n\r\n```\r\n\r\n\u003e **Note**\r\n\u003e\r\n\u003e Please use childFragmentManager instead of supportFragmentManager if you are using this code inside Fragment\r\n\u003e\r\n\u003e Also do not forget to replace all \"this\" calls with requireActivity()\r\n\r\n### Sync settings\r\n\r\nCreate an instance of Teslasoft ID client:\r\n\r\n```kotlin\r\nval client = TeslasoftIDClientBuilder(this)\r\n                .setApiKey(\"PASTE YOU API KEY HERE\")\r\n                .setAppId(\"PASTE YOU APP ID HERE\")\r\n                .setSettingsListener(settingsListener)\r\n                .setSyncListener(syncListener)\r\n                .build()\r\n```\r\n\r\n\u003e **Note**\r\n\u003e\r\n\u003e Fill out this form to request an API key: https://forms.gle/AZ4dNCLnsTpsVNNE6\r\n\r\nAdd settings listener and sync listener:\r\n\r\n```kotlin\r\nprivate val settingsListener: SettingsListener = object : SettingsListener {\r\n\r\n        /**\r\n         * onSuccess triggers when app retrieved their settings from the server.\r\n         *\r\n         * @param settings JSON string.\r\n         * */\r\n        override fun onSuccess(settings: String) {\r\n            ...\r\n        \r\n            runOnUiThread {\r\n                /* Work with UI elements here otherwise an Exception will be raised */\r\n            }\r\n        }\r\n\r\n        /**\r\n         * onError triggers when internal error is occurred. (ex. no Internet connection, invalid api key/session token/app signature\r\n         * or database is corrupted).\r\n         *\r\n         * @param state Reason of failure\r\n         * @param message Error message. Please use android string instead od this message. Android strings can be translated to other languages.\r\n         * This message is for developers only.\r\n         * */\r\n        override fun onError(state: String, message: String) {\r\n            ...\r\n        \r\n            runOnUiThread {\r\n                /* Work with UI elements here otherwise an Exception will be raised */\r\n            }\r\n        }\r\n    }\r\n```\r\n\r\n```kotlin\r\nprivate val syncListener: SyncListener = object : SyncListener {\r\n\r\n        /**\r\n         * onSuccess triggers when app retrieved their settings from the server.\r\n         * */\r\n        override fun onSuccess() {\r\n            ...\r\n        \r\n            runOnUiThread {\r\n                /* Work with UI elements here otherwise an Exception will be raised */\r\n            }\r\n        }\r\n\r\n        /**\r\n         * onError triggers when internal error is occurred. (ex. no Internet connection, invalid api key/session token/app signature\r\n         * or database is corrupted).\r\n         *\r\n         * @param state Reason of failure\r\n         * @param message Error message. Please use android string instead od this message. Android strings can be translated to other languages.\r\n         * This message is for developers only.\r\n         * */\r\n        override fun onError(state: String, message: String) {\r\n            ...\r\n        \r\n            runOnUiThread {\r\n                /* Work with UI elements here otherwise an Exception will be raised */\r\n            }\r\n        }\r\n    }\r\n```\r\n\r\nDetermine if user is signed in:\r\n\r\n```kotlin\r\nif (client?.doesUserSignedIn() == true) {\r\n    // Do your stuff here\r\n}\r\n```\r\n\r\nSave settings to the server:\r\n\r\n```kotlin\r\nclient?.syncAppSettings(settings)\r\n```\r\n\r\nLoad settings from the server:\r\n\r\n```kotlin\r\nclient?.getAppSettings()\r\n```\r\n\r\n\u003e **Warning**\r\n\u003e\r\n\u003e To avoid errors please make sure that user is signed in.\r\n\r\n## License\r\n\r\n```\r\nCopyright (c) 2023 Dmytro Ostapenko. All rights reserved.\r\n\r\nLicensed under the Apache License, Version 2.0 (the \"License\");\r\nyou may not use this file except in compliance with the License.\r\nYou may obtain a copy of the License at\r\n\r\n  http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nUnless required by applicable law or agreed to in writing, software\r\ndistributed under the License is distributed on an \"AS IS\" BASIS,\r\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\nSee the License for the specific language governing permissions and\r\nlimitations under the License.\r\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandraxdev%2Fteslasoft-id-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandraxdev%2Fteslasoft-id-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandraxdev%2Fteslasoft-id-client/lists"}