#jwt #user #detail #api #otpless

otpless_auth

to authenticate otpless jwt token for otpless user detail

3 releases

0.1.2 Nov 1, 2023
0.1.1 Nov 1, 2023
0.1.0 Nov 1, 2023

#1000 in Authentication

MIT license

11KB
167 lines

otpless_auth

Installation

Add the following to Cargo.toml:

otpless_auth = "0.1.2"

How to use

Import the get_otpless_user function

extern crate otpless_auth;
use otpless_auth::api::otpless::get_otpless_user;

method signature

pub fn get_otpless_user(jwt_token: &str, client_id: &str) -> Result<OtplessUserDetail, OtplessError>

Method Params:

Params Data type Mandatory Constraints Remarks
jwt_token String true token which you get from OTPLess
client_id String true Your OTPLess Client Id

Return

Return: Object Name: Result<OtplessUserDetail, OtplessError>

OtplessUserDetail Object Fields:

auth_time (Long, required): The time when authentication was completed.
phone_number (String, required): The user's phone number.
country_code (String, required): The country code of user's phone number.
national_phone_number (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.

OtplessError Object Fields:

message (String): The message contains error information.
jwt_error (Some): jsonwebtoken encoding and decoding error enum.

Dependencies

~8–21MB
~317K SLoC