Smarter Multitenant oAuth Library

Custom authentication backends for hosted Smarter platforms. Includes payment and account status verification.

To verify subscription status, use the following API call:

curl -X ‘GET’ ‘https://api.am.smarter.sh/accounts/subscription-status/’ -H ‘accept: application/json’ -H ‘X-Client-Domain: platform.smarter.sh’ -H ‘X-Client-Username: lmcdaniel’

Returns HTTP 200 if the subscription is active. 40x otherwise.

class smarter.lib.social_core.backends.multitenant.DjangoModelBackendMultitenant[source]

Bases: ModelBackend

Custom Django ModelBackend that also verifies payment status of the hosted platform.

authenticate(request, username=None, password=None, **kwargs)[source]
class smarter.lib.social_core.backends.multitenant.GithubOAuth2Multitenant(strategy=None, redirect_uri=None)[source]

Bases: GithubOAuth2

Custom GitHub OAuth2 backend that also verifies payment status of the hosted platform.

get_user_details(response)[source]

Return user details from Github account

class smarter.lib.social_core.backends.multitenant.GoogleOAuth2Multitenant(strategy=None, redirect_uri=None)[source]

Bases: GoogleOAuth2

Custom Google OAuth2 backend that also verifies payment status of the hosted platform.

get_user_details(response)[source]

Return user details from Google API account

smarter.lib.social_core.backends.multitenant.SUBSCRIPTION_STATUS_API_URL = 'https://api.am.smarter.sh/accounts/subscription-status/'

//github.com/smarter-sh/account-manager

Type:

API endpoint to verify subscription status. see https

smarter.lib.social_core.backends.multitenant.verify_payment_status(username)[source]

Verify the payment status of a user by making an API call to the Account Manager subscription status endpoint. Returns True if the subscription is active, False otherwise. In case of errors, defaults to returning True to avoid blocking access due to transient issues.

Return type:

bool