otpless-auth-sdk
Project description
Merchant Integration Documentation(Backend Python Auth SDK)
A. OTPLessAuth class
The OTPLessAuth class provides methods to integrate OTPLess authentication into your Python backend application. This
documentation explains the usage of the class and its methods.
Methods:
1. decodeIdToken
This method help to resolve idToken(JWT token) which is issued by OTPLess which return user detail
from that token also this method verify that token is valid, token should not expired and
issued by only otpless.com
Method Signature:
decode_id_token(id_token, client_id, client_secret, audience=None)
Method Params:
| Params | Data type | Mandatory | Constraints | Remarks |
|---|---|---|---|---|
| idToken | String | true | idToken which is JWT token which you get from OTPLess by exchange code API |
|
| clientId | String | true | Your OTPLess Client Id |
|
| clientSecret | String | true | Your OTPLess Client Secret |
Return
Return: Object Name: UserDetail
{'success': True, 'auth_time': 1697649943, 'phone_number': '+9193******', 'email': 'dev***@gmail.com', 'name': 'Devloper From OTP-less', 'country_code': '+91', 'national_phone_number': '9313******'}
2. verify code
This method help to resolve code which is return from OTPLess which will return user detail
from that code also this method verify that code is valid, code should not expired and
issued by only otpless.com
Method Signature:
verify_code(code, client_id, client_secret, audience)
Method Params:
| Params | Data type | Mandatory | Constraints | Remarks |
|---|---|---|---|---|
| code | String | true | code which you get from OTPLess |
|
| clientId | String | true | Your OTPLess Client Id |
|
| clientSecret | String | true | Your OTPLess Client Secret |
Return
Return: Object Name: UserDetail
{'success': True, 'auth_time': 1697649943, 'phone_number': '+9193******', 'email': 'dev***@gmail.com', 'name': 'Devloper From OTP-less', 'country_code': '+91', 'national_phone_number': '9313******'}
UserDetail Object Fields:
success (boolean): This will be true in case of method successfully performed operation.
authTime (Long, required): The time when authentication was completed.
phoneNumber (String, required): The user's phone number.
countryCode (String, required): The country code of user's phone number.
nationalPhoneNumber (String, required): The user's phone number without country code.
email (String, required): The user's email address.
name (String, required): The user's full name.
Error case:
success (boolean): This will be false. The method is failed to perform.
errorMessage (String): The message contains error information.
Example of usage
import OTPLessAuthSdk
# Setup necessary parameters
client_id = "your_client_id"
client_secret = "your_client_secret"
code = "your_id_token_here"
audience = None
# Use the verify_code function to verify the code and get user details
try:
user_details = OTPLessAuthSdk.UserDetail.verify_code(code, client_id, client_secret, audience)
print(f"User details: {user_details}")
except Exception as e:
print(f"An error occurred: {e}")
This method allows you to decode and verify OTPLess ID tokens and retrieve user information for integration into your backend Python application.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file OTPLessAuthSDK-0.1.4.tar.gz.
File metadata
- Download URL: OTPLessAuthSDK-0.1.4.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5380750925198c4783923a25c278e722aeee41eff125f765bfd8f49be089bb41
|
|
| MD5 |
300298cc1116baeb894668e9e7e18526
|
|
| BLAKE2b-256 |
c0fd3655ab6b6c385c7e52d1872668e7301b276def54e6832ef5cd4a53d4fedc
|
File details
Details for the file OTPLessAuthSDK-0.1.4-py3-none-any.whl.
File metadata
- Download URL: OTPLessAuthSDK-0.1.4-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
819bf16993b03450fb78d6bd85bf383fd444abe30e05e66cf8e59ab012dd13ce
|
|
| MD5 |
e53271f0dc86ce56ff111c4d312cd4bc
|
|
| BLAKE2b-256 |
697a0fc832858c26a7ac341fb21d85aded53c30412328dbc248a083d56c576da
|