Skip to content

chasenlab/better-auth-python

Repository files navigation

better-auth

GitHub Actions Workflow Status GitHub Release Date GitHub Release

Python Swagger openapi initiative

API Reference for your Better Auth Instance

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 1.1.0
  • Package version: 0.0.1-beta11
  • Generator version: 7.17.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python 3.9+

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install better-auth

(you may need to run pip with root permission: sudo pip install git+https://github.com/chasenlab/better-auth-python.git)

Then import the package:

import better_auth

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import better_auth

Tests

Execute pytest to run the tests.

Getting Started

Please follow the installation procedure and then run the following:

import better_auth
from better_auth.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:3000/api/auth
# See configuration.py for a list of all supported configuration parameters.
configuration = better_auth.Configuration(
    host = "http://localhost:3000/api/auth" # Replace with your API server host
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: bearerAuth
configuration = better_auth.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)


# Enter a context with an instance of the API client
with better_auth.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = better_auth.AdminApi(api_client)
    admin_ban_user_request = better_auth.AdminBanUserRequest() # AdminBanUserRequest | 

    try:
        api_response = api_instance.admin_ban_user(admin_ban_user_request)
        print("The response of AdminApi->admin_ban_user:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling AdminApi->admin_ban_user: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to http://localhost:3000/api/auth

Class Method HTTP request Description
AdminApi admin_ban_user POST /admin/ban-user
AdminApi admin_create_user POST /admin/create-user
AdminApi admin_get_user GET /admin/get-user
AdminApi admin_has_permission POST /admin/has-permission
AdminApi admin_impersonate_user POST /admin/impersonate-user
AdminApi admin_list_user_sessions POST /admin/list-user-sessions
AdminApi admin_list_users GET /admin/list-users
AdminApi admin_remove_user POST /admin/remove-user
AdminApi admin_revoke_user_session POST /admin/revoke-user-session
AdminApi admin_revoke_user_sessions POST /admin/revoke-user-sessions
AdminApi admin_set_user_password POST /admin/set-user-password
AdminApi admin_set_user_role POST /admin/set-role
AdminApi admin_stop_impersonating POST /admin/stop-impersonating
AdminApi admin_unban_user POST /admin/unban-user
AdminApi admin_update_user POST /admin/update-user
ApiKeyApi api_key_create_post POST /api-key/create
ApiKeyApi api_key_delete_post POST /api-key/delete
ApiKeyApi api_key_get_get GET /api-key/get
ApiKeyApi api_key_list_get GET /api-key/list
ApiKeyApi api_key_update_post POST /api-key/update
DefaultApi account_info_get GET /account-info
DefaultApi change_email POST /change-email
DefaultApi change_password POST /change-password
DefaultApi delete_user POST /delete-user
DefaultApi delete_user_callback_get GET /delete-user/callback
DefaultApi error_get GET /error
DefaultApi forget_password POST /request-password-reset
DefaultApi get_access_token_post POST /get-access-token
DefaultApi get_session GET /get-session
DefaultApi link_social_account POST /link-social
DefaultApi list_user_accounts GET /list-accounts
DefaultApi list_user_sessions GET /list-sessions
DefaultApi ok_get GET /ok
DefaultApi refresh_token_post POST /refresh-token
DefaultApi reset_password POST /reset-password
DefaultApi reset_password_callback GET /reset-password/{token}
DefaultApi revoke_other_sessions_post POST /revoke-other-sessions
DefaultApi revoke_session_post POST /revoke-session
DefaultApi revoke_sessions_post POST /revoke-sessions
DefaultApi send_verification_email POST /send-verification-email
DefaultApi sign_in_email POST /sign-in/email
DefaultApi sign_out POST /sign-out
DefaultApi sign_up_with_email_and_password POST /sign-up/email
DefaultApi social_sign_in POST /sign-in/social
DefaultApi unlink_account_post POST /unlink-account
DefaultApi update_user POST /update-user
DefaultApi verify_email_get GET /verify-email
OneTapApi one_tap_callback_post POST /one-tap/callback
PasskeyApi generate_passkey_registration_options GET /passkey/generate-register-options
PasskeyApi passkey_delete_passkey_post POST /passkey/delete-passkey
PasskeyApi passkey_generate_authenticate_options GET /passkey/generate-authenticate-options
PasskeyApi passkey_list_user_passkeys_get GET /passkey/list-user-passkeys
PasskeyApi passkey_update_passkey_post POST /passkey/update-passkey
PasskeyApi passkey_verify_authentication POST /passkey/verify-authentication
PasskeyApi passkey_verify_registration POST /passkey/verify-registration
StripeApi handle_stripe_webhook POST /stripe/webhook
TwoFactorApi two_factor_disable_post POST /two-factor/disable
TwoFactorApi two_factor_enable_post POST /two-factor/enable
TwoFactorApi two_factor_generate_backup_codes_post POST /two-factor/generate-backup-codes
TwoFactorApi two_factor_get_totp_uri_post POST /two-factor/get-totp-uri
TwoFactorApi two_factor_send_otp_post POST /two-factor/send-otp
TwoFactorApi two_factor_verify_backup_code_post POST /two-factor/verify-backup-code
TwoFactorApi two_factor_verify_otp_post POST /two-factor/verify-otp
TwoFactorApi two_factor_verify_totp_post POST /two-factor/verify-totp

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

apiKeyCookie

  • Type: API key
  • API key parameter name: apiKeyCookie
  • Location:

bearerAuth

  • Type: Bearer authentication

Author

chasenspace@gmail.com

About

python sdk for better-auth

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages