Download the PHP package otpless/otpless-auth-sdk without Composer
On this page you can find all versions of the php package otpless/otpless-auth-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download otpless/otpless-auth-sdk
More information about otpless/otpless-auth-sdk
Files in otpless/otpless-auth-sdk
Package otpless-auth-sdk
Short Description SDK for Backend PHP SDK for resolving idToken and more.
License MIT
Informations about the package otpless-auth-sdk
Merchant Integration Documentation(Backend PHP Auth SDK)
A. OTPLessAuth Dependency
install Below dependency in your project's
you can also get latest version of dependency at https://packagist.org/packages/otpless/otpless-auth-sdk
B. OTPLessAuth class
The OtplessAuth
class provides methods to integrate OTPLess authentication into your PHP 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:
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
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:
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
3. Verify Auth Token
This method help to resolve 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:
Method Params:
Params | Data type | Mandatory | Constraints | Remarks |
---|---|---|---|---|
token | String | true | token which you get from OTPLess |
|
clientId | String | true | Your OTPLess Client Id |
|
clientSecret | String | true | Your OTPLess Client Secret |
Return
Return: Object Name: UserDetail
4. Generate Magic link
The Authorization Endpoint initiates the authentication process by sending a magic link
to the user's WhatsApp or email, based on the provided contact information. This link is used to verify the identity of the user. Upon the user's action on this link, they are redirected to the specified URI with an authorization code included in the redirection.
Method Signature:
Method Params:
Params | Data type | Mandatory | Constraints | Remarks |
---|---|---|---|---|
channel | String | false | if no channel given WHATSAPP is chosen as default | WHATSAPP/SMS |
mobile_number | String | false | At least one required | The user's mobile number for authentication in the format: country code + number (e.g., 91XXXXXXXXXX) |
String | false | At least one required | The user's email address for authentication. | |
redirect_uri | String | true | The URL to which the user will be redirected after authentication. This should be URL-encoded | |
clientId | String | true | Your OTPLess Client Id |
|
clientSecret | String | true | Your OTPLess Client Secret |
Return
Return: Object Name: RquestIds
Example of usage
5. Send OTP
This method help to send OTP to your users and OTP issued by only otpless.com
Method Params:
Params | Data type | Mandatory | Constraints | Remarks |
---|---|---|---|---|
phoneNumber | String | true | Mobile Number of your users | |
String | true | Mail Id of your users | ||
channel | String | false | WHATSAPP, SMS | |
hash | String | true | Your mobile application Hash | |
orderId | String | true | Unique Order id | |
expiry | Int | false | OTP expiry in sec | |
otpLength | String | false | Values like 6 or 4 | |
clientId | String | true | Your OTPLess Client Id |
|
clientSecret | String | true | Your OTPLess Client Secret |
Return
6. ReSend OTP
This method help to resend OTP to your users and OTP issued by only otpless.com
Method Params:
Params | Data type | Mandatory | Constraints | Remarks |
---|---|---|---|---|
orderId | String | true | Unique Order id(same as send method) | |
clientId | String | true | Your OTPLess Client Id |
|
clientSecret | String | true | Your OTPLess Client Secret |
Return
7. Verify OTP
This method help to Verify OTP to your users and OTP issued by only otpless.com
Method Signature:
Method Params:
Params | Data type | Mandatory | Constraints | Remarks |
---|---|---|---|---|
String | true | Mail Id of your users | ||
phoneNumber | String | true | Mobile Number of your users | |
orderId | String | true | Unique Order id | |
otp | String | true | Enter otp here | |
clientId | String | true | Your OTPLess Client Id |
|
clientSecret | String | true | Your OTPLess Client Secret |
8. Send OTP V2
This method help to send OTP to your users and OTP issued by only otpless.com
Method Params:
Params | Data type | Mandatory | Constraints | Remarks |
---|---|---|---|---|
phoneNumber | String | true | Mobile Number of your users | |
String | true | Mail Id of your users | ||
channel | List |
false | ["WHATSAPP"], ["SMS"] | |
hash | String | false | Your mobile application Hash | |
expiry | Int | false | OTP expiry in sec | |
otpLength | String | false | Values like 6 or 4 | |
metadata | Object | false | ||
clientId | String | true | Your OTPLess Client Id |
|
clientSecret | String | true | Your OTPLess Client Secret |
Return
200 OK
4XX
9. verify otp V2
Method Params:
Params | Data type | Mandatory | Constraints | Remarks |
---|---|---|---|---|
requestId | String | true | Unique requestId (from sendOTP) | |
otp | String | true | OTP | |
clientId | String | true | Your OTPLess Client Id |
|
clientSecret | String | true | Your OTPLess Client Secret |
Return
200 OK
4XX
9. send magic link
Method Params:
Params | Data type | Mandatory | Constraints | Remarks |
---|---|---|---|---|
phoneNumber | String | true | Mobile Number of your users | |
String | true | Mail Id of your users | ||
channels | List |
false | ["WHATSAPP"], ["SMS"] | |
redirectURI | String | true | redirect Url | |
expiry | Int | false | Link expiry in sec | |
metadata | Object | false | ||
clientId | String | true | Your OTPLess Client Id |
|
clientSecret | String | true | Your OTPLess Client Secret |
Return
200 OK
4XX
10. send otp link
Method Params:
Params | Data type | Mandatory | Constraints | Remarks |
---|---|---|---|---|
phoneNumber | String | true | Mobile Number of your users | |
String | true | Mail Id of your users | ||
channels | List |
false | ["WHATSAPP"], ["SMS"] | |
redirectURI | String | true | redirect Url | |
expiry | Int | false | OTP and Link expiry in sec | |
otpLength | String | false | Values like 6 or 4 | |
metadata | Object | false | ||
clientId | String | true | Your OTPLess Client Id |
|
clientSecret | String | true | Your OTPLess Client Secret |
Return
200 OK
4XX
9. verify code
Method Params:
Params | Data type | Mandatory | Constraints | Remarks |
---|---|---|---|---|
phoneNumber | String | true | Mobile Number of your users | |
String | true | Mail Id of your users | ||
channels | List |
false | ["WHATSAPP"], ["SMS"] | |
redirectURI | String | true | redirect Url | |
expiry | Int | false | Link expiry in sec | |
metadata | Object | false | ||
clientId | String | true | Your OTPLess Client Id |
|
clientSecret | String | true | Your OTPLess Client Secret |
Return
200 OK
4XX
11. initiateOAuth
Method Params:
Params | Data type | Mandatory | Constraints | Remarks |
---|---|---|---|---|
channels | List |
true | ["WHATSAPP"] | |
redirectURI | String | true | redirect Url | |
expiry | Int | false | Link expiry in sec | |
metadata | Object | false | ||
clientId | String | true | Your OTPLess Client Id |
|
clientSecret | String | true | Your OTPLess Client Secret |
Return
200 OK
4XX
12. check status
Method Params:
Params | Data type | Mandatory | Constraints | Remarks |
---|---|---|---|---|
requestId | String | true | Got from Initiate OAUTH V2 API | |
clientId | String | true | Your OTPLess Client Id |
|
clientSecret | String | true | Your OTPLess Client Secret |
Return
200 OK
4XX
All versions of otpless-auth-sdk with dependencies
firebase/php-jwt Version ^5.0
phpseclib/phpseclib Version ^3.0