Methods
Below are the methods provided by the Wepin Compose Multiplatform Login Library.
Last updated
Was this helpful?
Below are the methods provided by the Wepin Compose Multiplatform Login Library.
Last updated
Was this helpful?
Opens an in-app browser and logs in to the OAuth provider. To retrieve Firebase login information, you need to call the loginWithIdToken()
or loginWithAccessToken()
methods.
params <LoginOauth2Params>
provider <'google'|'naver'|'discord'|'apple'>
The OAuth login Provider
clientId <String>
The client ID of the OAuth login provider
Returns
<LoginOauthResult>
provider <String>
The name of the OAuth provider used.
token <String>
The accessToken (if provider is "naver" or "discord") or idToken (if provider is "google" or "apple")
type <OauthTokenType>
The type of OAuth token (e.g., idToken, accessToken)
Exception
Example
Parameters
params <LoginWithEmailParams>
email <String>
User email
password <String>
User password
locale <String>
Language for the verification email (default value: "en")
Returns
<LoginResult>
provider <Providers.EMAIL>
The provider used for the login (in this case, 'email')
token <FBToken>
idToken <String>
The Wepin Firebase ID token
refreshToken <String>
The Wepin Firebase refresh token
Exception
Example
Logs in to Wepin Firebase using an email and password. If the login is successful, it returns Firebase login information.
Parameters
params <LoginWithEmailParams>
email <String>
User email
password <String>
User password
Returns
<LoginResult>
provider <Providers.EMAIL>
The provider used for the login (in this case, 'email')
token <FBToken>
idToken <String>
The Wepin Firebase ID token
refreshToken <String>
The Wepin Firebase refresh token
Exception
Example
Logs in to Wepin Firebase using an external ID token. If the login is successful, it returns Firebase login information.
Parameters
params <LoginOauthIdTokenRequest>
idToken <String>
ID token value to be used for login
Returns
<LoginResult>
provider <Providers.EXTERNAL_TOKEN>
The provider used for the login
token <FBToken>
idToken <String>
The Wepin Firebase ID token
refreshToken <String>
The Wepin Firebase refresh token
Exception
Example
Logs in to Wepin Firebase using an external access token. If the login is successful, it returns Firebase login information.
Parameters
params <LoginOauthAccessTokenRequest>
provider <'naver'|'discord'|'facebook'>
Provider that issued the access token.
accessToken <String>
Access token value to be used for login.
Returns
<LoginResult>
provider <Providers.EXTERNAL_TOKEN>
The provider used for the login
token <FBToken>
idToken <String>
The Wepin Firebase ID token
refreshToken <String>
The Wepin Firebase refresh token
Exception
Example
Retrieves information on the current Wepin Firebase token.
Parameters
None
Returns
<LoginResult>
provider <Providers.EXTERNAL_TOKEN>
The provider used for the login
token <FBToken>
idToken <String>
The Wepin Firebase ID token
refreshToken <String>
The Wepin Firebase refresh token.
Exception
Example
Supported from version 0.0.10
and later.
This method combines the functionality of loginWithOauthProvider
, loginWithIdToken
, loginWithAccessToken
. It opens an in-app browser to log in to Wepin Firebase through the specified OAuth login provider. Upon successful login, it returns Firebase login information. This method is a suspend method, so you can call it within another suspend method or in a coroutine.
Parameters
params <
LoginOauth2Params>
provider <'google'|'naver'|'discord'|'apple'>
The OAuth login Provider
clientId <String>
The client ID of the OAuth login provider
Returns
<LoginResult>
provider <Providers.EXTERNAL_TOKEN>
The provider used for the login
token <FBToken>
idToken <String>
The Wepin Firebase ID token
refreshToken <String>
The Wepin Firebase refresh token.
Exception
Example
Supported from version 0.0.10
and later.
This method combines the functionality of loginFirebaseWithOauthProvider
and loginWepin
. It opens an in-app browser to log in to Wepin through the specified OAuth login provider. Upon successful login, it returns Wepin user information. This method is a suspend method, so you can call it within another suspend method or in a coroutine.
Parameters
params <
LoginOauth2Params>
provider <'google'|'naver'|'discord'|'apple'>
The OAuth login Provider
clientId <String>
The client ID of the OAuth login provider
Returns
<WepinUser> (optional)
status <'success' | 'fail'>
The login status
userInfo <UserInfo>
(optional)
The user's information, including:
userId <String>
The user's ID
email <String>
The user's email
provider <'google'|'naver'|'discord'|'apple'|'email' | 'external_token'>
The login provider
use2FA <Boolean>
Whether the user uses two-factor authentication
walletId <String>
The user's wallet ID
userStatus <UserStatus>
(optional)
The user's Wepin login status, including:
loginStatus <WepinLoginStatus - 'complete' | 'pinRequired' | 'registerRequired'>
If the user's loginStatus
value is not 'complete', the user must register with Wepin.
pinRequired <Boolean>
Whether a PIN is required
token <Token>
The user's Wepin token
accessToken <String>
The access token
refreshToken <String>
The refresh token
Exception
Example
Supported from version 0.0.10
and later.
This method integrates the functions of loginWithEmailAndPassword
and loginWepin
. The loginWepinWithEmailAndPassword
method logs the user into Wepin using the provided email and password. Upon successful login, it returns Wepin user information. This method is a suspend method, so you can call it within another suspend method or in a coroutine.
Parameters
params <LoginWithEmailParams>
email <String>
User email
password <String>
User password
Returns
<WepinUser> (optional)
status <'success' | 'fail'>
The login status
userInfo <UserInfo>
(optional)
The user's information, including:
userId <String>
The user's ID
email <String>
The user's email
provider <'google'|'naver'|'discord'|'apple'|'email' | 'external_token'>
The login provider
use2FA <Boolean>
Whether the user uses two-factor authentication
walletId <String>
The user's wallet ID
userStatus <UserStatus>
(optional)
The user's Wepin login status, including:
loginStatus <WepinLoginStatus - 'complete' | 'pinRequired' | 'registerRequired'>
If the user's loginStatus
value is not 'complete', the user must register with Wepin.
pinRequired <Boolean>
Whether a PIN is required
token <Token>
The user's Wepin token
accessToken <String>
The access token
refreshToken <String>
The refresh token
Exception
Example
Supported from version 0.0.10
and later.
This method integrates the funcions of loginWithIdToken
and loginWepin
. The loginWepinWithIdToken
method logs the user info Wepin using an external ID token. Upon successful login, it returns Wepin user information. This method is a suspend method, so you can call it within another suspend method or in a coroutine.
Parameters
params <LoginOauthIdTokenRequest>
idToken <String>
ID token value to be used for login
Returns
<WepinUser> (optional)
status <'success' | 'fail'>
The login status
userInfo <UserInfo>
(optional)
The user's information, including:
userId <String>
The user's ID
email <String>
The user's email
provider <'google'|'naver'|'discord'|'apple'|'email' | 'external_token'>
The login provider
use2FA <Boolean>
Whether the user uses two-factor authentication
walletId <String>
The user's wallet ID
userStatus <UserStatus>
(optional)
The user's Wepin login status, including:
loginStatus <WepinLoginStatus - 'complete' | 'pinRequired' | 'registerRequired'>
If the user's loginStatus
value is not 'complete', the user must register with Wepin.
pinRequired <Boolean>
Whether a PIN is required
token <Token>
The user's Wepin token
accessToken <String>
The access token
refreshToken <String>
The refresh token
Exception
Example
Supported from version 0.0.10
and later.
This method integrates the functions of loginWithAccessToken
and loginWepin
. The loginWepinWithAccessToken
method logs the user into Wepin using an external access token. Upon successful login, it returns Wepin user information. This method is a suspend method, so you can call it within another suspend method or in a coroutine.
Parameters
params <LoginOauthAccessTokenRequest>
provider <'naver'|'discord'|'facebook'>
Provider that issued the access token.
accessToken <String>
Access token value to be used for login.
Returns
<WepinUser> (optional)
status <'success' | 'fail'>
The login status
userInfo <UserInfo>
(optional)
The user's information, including:
userId <String>
The user's ID
email <String>
The user's email
provider <'google'|'naver'|'discord'|'apple'|'email' | 'external_token'>
The login provider
use2FA <Boolean>
Whether the user uses two-factor authentication
walletId <String>
The user's wallet ID
userStatus <UserStatus>
(optional)
The user's Wepin login status, including:
loginStatus <WepinLoginStatus - 'complete' | 'pinRequired' | 'registerRequired'>
If the user's loginStatus
value is not 'complete', the user must register with Wepin.
pinRequired <Boolean>
Whether a PIN is required
token <Token>
The user's Wepin token
accessToken <String>
The access token
refreshToken <String>
The refresh token
Exception
Example
Logs the user into Wepin using the Wepin Firebase token.
Parameters
Returns
<WepinUser> (optional)
status <'success' | 'fail'>
The login status
userInfo <UserInfo>
(optional)
The user's information, including:
userId <String>
The user's ID
email <String>
The user's email
provider <'google'|'naver'|'discord'|'apple'|'email' | 'external_token'>
The login provider
use2FA <Boolean>
Whether the user uses two-factor authentication
walletId <String>
The user's wallet ID
userStatus <UserStatus>
(optional)
The user's Wepin login status, including:
loginStatus <WepinLoginStatus - 'complete' | 'pinRequired' | 'registerRequired'>
If the user's loginStatus
value is not 'complete', the user must register with Wepin.
pinRequired <Boolean>
Whether a PIN is required
token <Token>
The user's Wepin token
accessToken <String>
The access token
refreshToken <String>
The refresh token
Exception
Example
Retrieves information about the currently logged-in user in Wepin.
Parameters
None
Returns
<WepinUser>
status <'success' | 'fail'>
The login status
userInfo <UserInfo>
(optional)
The user's information, including:
userId <String>
The user's ID
email <String>
The user's email
provider <'google'|'naver'|'discord'|'apple'|'email' | 'external_token'>
The login provider
use2FA <Boolean>
Whether the user uses two-factor authentication
walletId <String>
The user's wallet ID
userStatus <UserStatus>
(optional)
The user's Wepin login status, including:
loginStatus <WepinLoginStatus - 'complete' | 'pinRequired' | 'registerRequired'>
If the user's loginStatus
value is not 'complete', the user must register with Wepin.
pinRequired <Boolean>
Whether a PIN is required
token <Token>
The user's Wepin token
accessToken <String>
The access token
refreshToken <String>
The refresh token
Exception
Example
Logs out the currently logged-in user from Wepin.
Parameters
None
Returns
<Boolean>
Exception
Example
Generates a signature for verifying the issuer. This method is mainly used to generate signatures for login-related information such as ID tokens and access tokens.
Parameters
privateKey <String>
The authentication key used for signature generation
message <String>
The message or payload to be signed
Returns
<String> - The generated signature
Exception
Example
Terminates the Wepin Login Library.
Parameters
None
Returns
None
Exception
Example
INVALID_APP_KEY
"Invalid app key"
The Wepin app key is invalid.
INVALID_PARAMETER
`
"Invalid parameter"
One or more parameters provided are invalid or missing.
INVALID_LOGIN_PROVIDER
"Invalid login provider"
The login provider specified is not supported or is invalid.
INVALID_TOKEN
"Token does not exist"
The token does not exist.
INVALID_LOGIN_SESSION
"Invalid Login Session"
The login session information does not exist.
NOT_INITIALIZED_ERROR
"Not initialized error"
The WepinLoginLibrary has not been properly initialized.
ALREADY_INITIALIZED_ERROR
"Already initialized"
The WepinLoginLibrary is already initialized, so the logout operation cannot be performed again.
NOT_ACTIVITY
"Context is not activity"
The Context is not an activity
USER_CANCELLED
"User cancelled"
The user has cancelled the operation.
UNKNOWN_ERROR
"An unknown error occurred"
An unknown error has occurred, and the cause is not identified.
NOT_CONNECTED_INTERNET
"No internet connection"
The system is unable to detect an active internet connection.
FAILED_LOGIN
"Failed to Oauth log in"
The login attempt has failed due to incorrect credentials or other issues.
ALREADY_LOGOUT
"Already Logout"
The user is already logged out, so the logout operation cannot be performed again.
INVALID_EMAIL_DOMAIN
"Invalid email domain"
The provided email address's domain is not allowed or recognized by the system.
FAILED_SEND_EMAIL
"Failed to send email"
The system encountered an error while sending an email. This is because the email address is invalid or we sent verification emails too often. Please change your email or try again after 1 minute.
REQUIRED_EMAIL_VERIFIED
"Email verification required"
Email verification is required to proceed with the requested operation.
INCORRECT_EMAIL_FORM
"Incorrect email format"
The provided email address does not match the expected format.
INCORRECT_PASSWORD_FORM
"Incorrect password format"
The provided password does not meet the required format or criteria.
NOT_INITIALIZED_NETWORK
"Network Manager not initialized"
The network or connection required for the operation has not been properly initialized.
REQUIRED_SIGNUP_EMAIL
"Email sign-up required."
The user needs to sign up with an email address to proceed.
FAILED_EMAIL_VERIFIED
"Failed to verify email."
The WepinLoginLibrary encountered an issue while attempting to verify the provided email address.
FAILED_PASSWORD_SETTING
"Failed to set password."
The WepinLoginLibrary failed to set the password.
EXISTED_EMAIL
"Email already exists."
The provided email address is already registered in Wepin.
Sign up for Wepin Firebase with an email and password. For users who have not yet registered, a verification email will be sent, and a REQUIRED_EMAIL_VERIFIED
error will occur if verification is required. If the user is already registered, an EXISTED_EMAIL
error will occur, and you should proceed with the login process by calling . Upon successful login, Firebase login information is returned.
sign <String>
(optional)
Signature value for the token provided as the first parameter (returned value of )
Starting from wepin-compose-sdk-login-v1 version 0.0.10, the sign value is optional. If you choose to remove the authentication key issued from the (Wepin Workspace > Developer Tools menu > Login tab > Auth Key > Delete), you may opt not to use the sign
value. The Auth Key menu is visible only if an authentication key was previously generated.
sign <String>
(optional)
Signature value for the Access token (returned value of ).
Starting from wepin-compose-sdk-login-v1 version 0.0.10, the sign value is optional. If you choose to remove the authentication key issued from the (Wepin Workspace > Developer Tools menu > Login tab > Auth Key > Delete), you may opt not to use the sign
value. The Auth Key menu is visible only if an authentication key was previously generated.
This method can only be used after the authentication key has been deleted from the (Wepin Workspace > Developer Tools menu > Login tab > Auth Key > Delete). The Auth Key menu is visible only if an authentication key was previously generated.
sign <String>
(optional)
Signature value for the token provided as the first parameter (returned value of )
Starting from wepin-compose-sdk-login-v1 version 0.0.10, the sign value is optional. If you choose to remove the authentication key issued from the (Wepin Workspace > Developer Tools menu > Login tab > Auth Key > Delete), you may opt not to use the sign
value. The Auth Key menu is visible only if an authentication key was previously generated.
sign <String>
(optional)
Signature value for the Access token (returned value of ).
Starting from wepin-compose-sdk-login-v1 version 0.0.10, the sign value is optional. If you choose to remove the authentication key issued from the (Wepin Workspace > Developer Tools menu > Login tab > Auth Key > Delete) , you may opt not to use the sign
value. The Auth Key menu is visible only if an authentication key was previously generated.
params <LoginResult>
Parameters from the return value of methods like, , or
The key for signing can be obtained from . In the Development Tools menu, click Get your authentication key on the Login tab to retrieve the authentication key.
The private key (privateKey) must be securely stored and should not be exposed externally. To enhance security and protect sensitive information, it is recommended to execute the getSignForLogin()
method on the backend rather than the frontend. For details on how to generate signatures, please refer to the .