GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - tfasoft/sdk-python: TFAsoft Python library.

This repository was archived by the owner on Nov 1, 2026. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

33 Commits
33 Commits

Folders and files

NameName
Last commit message
Last commit date
tfa_python_sdk
tfa_python_sdk
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
requirements.txt
requirements.txt
 
 
setup.cfg
setup.cfg
 
 
setup.py
setup.py
 
 
test.py
test.py
 
 

Repository files navigation

Telegram Factor Authentication - Python SDK

Important

Repository Migration

This repository has moved to GitLab.

All active development and maintenance now take place at:

View the repository on GitLab

This GitHub repository is retained for historical reference. Please use the GitLab repository for the latest updates, issues, and contributions.

Python SDK document is in docs.tfasoft.com

If you are using TFA as your authentication service in your python applications, you can use our library.

How to use the library

So, let's have a quick review of our steps.

  • Installation
  • Configuration
  • Checking result

Installation

The easiest step is installation. You can install it with pip or pipenv. Just go ahead and enter the command below:

$ pip3 install tfa-python-sdk

Congratulations! First step is done!

Configuration

After installation, go to your file and import the library:

from tfa_python_sdk import TFA

Second, you need to epecify the accecc_token. You can get it in your dashboard panel. So, call the class:

auth = TFA('access_token')

Ok, now library know your access token. Now it's time to enter the user_token. User token is the code you get it from your form field or a post method. Importent is to get user token. So, we use authUser function to pass user token and get the result.

result = auth.authUser('user_token')

You are done it this step. Let's move forward and check status codes and check user result.

Checking result

When you get the result, you can check codes and see what are them. Here is a quick review:

statCode = result['status']
data = result['data']

if (statCode == 200):
    print('Authenticated.')
    user = data['user']
else:
    print(data['message'])

Now if your code is 200, it means that you know have user. If it is else, it means your code is 401. For object that returns to you, chesk object below.

Returned Objects

Here let's know about them in deep.

  • 200

{
    "user": {
        "_id": "document id",
        "uid": "telegram user id",
        "token": "one time token. Every time become null",
        "createdAt": "when created",
        "updatedAt": "last update",
        "__v": 0
    }
}
  • 401

One is access token is wrong.

{
    "message": "User authentication token is not valid"
}

Another is when user token is wrong.

{
    "message": "Admin access token is not valid"
}

Development

If you want to develop the library, it is so simple. Edit library codes and run test.py like this:

$ python3 test.py

Before you start: **Remember the base or codes are stored in tfa_python_sdk/tfa_python_sdk.py. You need to edit there.

About

TFAsoft Python library.

pypi.org/project/tfa-python-sdk

Topics

authenticationpypipythonsdktfasoft

Resources

Readme
MIT license
Activity
Custom properties

Stars

9 stars

Watchers

2 watching

Forks

1 fork
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.