Download the PHP package zsgogo/otpless-auth-sdk without Composer
On this page you can find all versions of the php package zsgogo/otpless-auth-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zsgogo/otpless-auth-sdk
More information about zsgogo/otpless-auth-sdk
Files in zsgogo/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
All versions of otpless-auth-sdk with dependencies
firebase/php-jwt Version ^5.0
phpseclib/phpseclib Version ^3.0