Package: onlyauth
OnlyAuth Python LibrarySDK InstallationpipinstallonlyauthSign up for OnlyAuth 2FA APISign up for theOnlyAuth 2FA APIto get your API credentials.SDK Example UsageExampleimportonlyauthfromonlyauth.modelsimportoperationss=onlyauth.Onlyauth(bearer_auth="<YOUR_API_SECRET>",)req=operations.CreateAccessTokenRequestBody(app_id='<APPX-XXX>',client_id='<CLNT-XXX>',end_user_phone_number='<+14151002000>',end_user_uuid='<12345>',redirect_uri='<https://www.example.com>',language='<en-US>',region='<us-1>',)res=s.authentication.create_access_token(req)ifres.objectisnotNone:# handle responsepassAvailable Resources and Operationsauthenticationcreate_access_token- Creates a short-lived JWT token to integrate the widgetvalidate_success_token- Validates a success token after user completes authenticationappsget_apps- Get all appsnew_app- Create a new appdelete_app- Delete an appget_app_by_id- Get an app by uuidupdate_app- Update an appError HandlingHandling errors in this SDK should largely match your expectations.  All operations return a response object or raise an error.  If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate Error type.Error ObjectStatus CodeContent Typeerrors.ErrorResponse400,401application/jsonerrors.SDKError4x-5xx/Exampleimportonlyauthfromonlyauth.modelsimporterrors,operationss=onlyauth.Onlyauth(bearer_auth="<YOUR_BEARER_TOKEN_HERE>",)req=operations.CreateAccessTokenRequestBody(app_id='<value>',client_id='<value>',end_user_phone_number='<value>',end_user_uuid='<value>',redirect_uri='<value>',language='<value>',region='<value>',)res=Nonetry:res=s.authentication.create_access_token(req)excepterrors.ErrorResponsease:# handle exceptionraise(e)excepterrors.SDKErrorase:# handle exceptionraise(e)ifres.objectisnotNone:# handle responsepassServer SelectionSelect Server by IndexYou can override the default server globally by passing a server index to theserver_idx: intoptional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:#ServerVariables0https://api.onlyauth.ioNoneExampleimportonlyauthfromonlyauth.modelsimportoperationss=onlyauth.Onlyauth(server_idx=0,bearer_auth="<YOUR_BEARER_TOKEN_HERE>",)req=operations.CreateAccessTokenRequestBody(app_id='<value>',client_id='<value>',end_user_phone_number='<value>',end_user_uuid='<value>',redirect_uri='<value>',language='<value>',region='<value>',)res=s.authentication.create_access_token(req)ifres.objectisnotNone:# handle responsepassOverride Server URL Per-ClientThe default server can also be overridden globally by passing a URL to theserver_url: stroptional parameter when initializing the SDK client instance. For example:importonlyauthfromonlyauth.modelsimportoperationss=onlyauth.Onlyauth(server_url="https://api.onlyauth.io",bearer_auth="<YOUR_BEARER_TOKEN_HERE>",)req=operations.CreateAccessTokenRequestBody(app_id='<value>',client_id='<value>',end_user_phone_number='<value>',end_user_uuid='<value>',redirect_uri='<value>',language='<value>',region='<value>',)res=s.authentication.create_access_token(req)ifres.objectisnotNone:# handle responsepassCustom HTTP ClientThe Python SDK makes API calls using therequestsHTTP library.  In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a customrequests.Sessionobject.For example, you could specify a header for every request that this sdk makes as follows:importonlyauthimportrequestshttp_client=requests.Session()http_client.headers.update({'x-custom-header':'someValue'})s=onlyauth.Onlyauth(client:http_client)AuthenticationPer-Client Security SchemesThis SDK supports the following security scheme globally:NameTypeSchemebearer_authhttpHTTP BearerTo authenticate with the API thebearer_authparameter must be set when initializing the SDK client instance. For example:importonlyauthfromonlyauth.modelsimportoperationss=onlyauth.Onlyauth(bearer_auth="<YOUR_BEARER_TOKEN_HERE>",)req=operations.CreateAccessTokenRequestBody(app_id='<value>',client_id='<value>',end_user_phone_number='<value>',end_user_uuid='<value>',redirect_uri='<value>',language='<value>',region='<value>',)res=s.authentication.create_access_token(req)ifres.objectisnotNone:# handle responsepassDevelopmentMaturityThis SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
looking for the latest version.ContributionsWhile we value open-source contributions to this SDK, this library is generated programmatically.
Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release!