
Product
Socket Now Supports pylock.toml Files
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
otpless-next-js-auth-sdk
Advanced tools
A. OTPLessAuth Dependency
You can install the OTPLessAuth SDK using npm:
npm install otpless-next-js-auth-sdk
B. OTPLessAuth class
The OTPLessAuth
Next.js SDK is a powerful library that enables you to perform authentication using the OTPLess service. This SDK simplifies the integration of OTPLess authentication into your Next.js applications.
1. 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
const userDetail = await verifyToken(token, clientId, clientSecret);
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: Object Name: UserDetail
2. Decode IdToken
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
const userDetail = await decodeIdToken(
idToken,
clientId,
clientSecret
);
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: Object Name: UserDetail
3. 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
const userDetail = await verifyCode(code, clientId, clientSecret);
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: Object Name: UserDetail
4. Magic Link
This method help to get magic link
which is return from OTPLess
which will return token
and request id from that mobile number or email id. Issued by only otpless.com
const magicLinkTokens = await magicLink(mobile, email, redirectURI, clientId, clientSecret);
Params | Data type | Mandatory | Constraints | Remarks |
---|---|---|---|---|
mobile | String | false | Input by your user. | |
String | false | Input by your user. | ||
redirectURI | String | true | Your redirectURI. | |
channel | String | false | WHATSAPP/SMS (if no channel given WHATSAPP is chosen as default) | |
clientId | String | true | Your OTPLess Client Id | |
clientSecret | String | true | Your OTPLess Client Secret |
Return: Object Name: magicLinkTokens
UserDetail Object Fields:
success
(boolean): This will betrue
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.
name
(String, required): The user's full name.
MagicLinkTokens Object Fields:
success
(boolean): This will betrue
in case of method successfully performed operation.
requestIds
(List, required): List of Token and Type of AUth.
type
(String, required): Auth type.
value
(String, required): Token value.
success
(boolean): This will be false
. The method is failed to perform.
errorMessage
(String): The message contains error information.
import { decodeIdToken } from 'otpless-next-js-auth-sdk';
const idToken = "..."; // Replace with your ID token
const clientId = "..."; // Replace with your client ID
const clientSecret = "..."; // Replace with your client secret
const userDetail = await decodeIdToken(idToken, clientId, clientSecret);
console.log("User Details:", userDetail);
This method allows you to decode and verify OTPLess tokens and retrieve user information for integration into your next js application.
FAQs
NextJs SDK for authenticating users.
The npm package otpless-next-js-auth-sdk receives a total of 2 weekly downloads. As such, otpless-next-js-auth-sdk popularity was classified as not popular.
We found that otpless-next-js-auth-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.
Research
Security News
Malicious Ruby gems typosquat Fastlane plugins to steal Telegram bot tokens, messages, and files, exploiting demand after Vietnam’s Telegram ban.