Methods
Below are the methods provided by the Wepin Compose Multiplatform Login Library.
loginWithOauthProvider
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.
Parameters
params
<LoginOauth2Params>
provider
<'google'|'naver'|'discord'|'apple'>
The OAuth login ProviderclientId
<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
signUpWithEmailAndPassword
Signs up to Wepin Firebase using an email and password. If the sign-up is successful, it returns Firebase login information.
Parameters
params
<LoginWithEmailParams>
email
<String>
User emailpassword
<String>
User passwordlocale
<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 tokenrefreshToken
<String>
The Wepin Firebase refresh token
Exception
Example
loginWithEmailAndPassword
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 emailpassword
<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 tokenrefreshToken
<String>
The Wepin Firebase refresh token
Exception
Example
loginWithIdToken
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 loginsign
<String>
Signature value for the token provided as the first parameter (returned value ofgetSignForLogin()
)
Returns
<LoginResult>
provider
<Providers.EXTERNAL_TOKEN>
The provider used for the logintoken
<FBToken>
idToken
<String>
The Wepin Firebase ID tokenrefreshToken
<String>
The Wepin Firebase refresh token
Exception
Example
loginWithAccessToken
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'>
Provider that issued the access token.accessToken
<String>
Access token value to be used for login.sign
<String>
Signature value for the Access token (returned value ofgetSignForLogin()
).
Returns
<LoginResult>
provider
<Providers.EXTERNAL_TOKEN>
The provider used for the logintoken
<FBToken>
idToken
<String>
The Wepin Firebase ID tokenrefreshToken
<String>
The Wepin Firebase refresh token
Exception
Example
getRefreshFirebaseToken
Retrieves information on the current Wepin Firebase token.
Parameters
None
Returns
<LoginResult>
provider
<Providers.EXTERNAL_TOKEN>
The provider used for the logintoken
<FBToken>
idToken
<String>
The Wepin Firebase ID tokenrefreshToken
<String>
The Wepin Firebase refresh token.
Exception
Example
loginWepin
Logs the user into Wepin using the Wepin Firebase token.
Parameters
params
<LoginResult>
Parameters from the return value of methods likeloginWithEmailAndPassword()
,loginWithIdToken()
, orloginWithAcccessToken()
Returns
<WepinUser>
status
<'success' | 'fail'>
The login statususerInfo
<UserInfo>
(optional) The user's information, including:userId
<String>
The user's IDemail
<String>
The user's emailprovider
<'google' | 'apple' | 'naver' | 'discord' | 'email' | 'external_token'>
The login provideruse2FA
<Boolean>
Whether the user uses two-factor authentication
walletId
<String>
The user's wallet IDuserStatus
<UserStatus>
(optional) The user's Wepin login status, including:loginStatus
<WepinLoginStatus - 'complete' | 'pinRequired' | 'registerRequired'>
If the user'sloginStatus
value is not 'complete', the user must register with Wepin.pinRequired
<Boolean>
Whether a PIN is required
token
<Token>
The user's Wepin tokenaccessToken
<String>
The access tokenrefreshToken
<String>
The refresh token
Exception
Example
getCurrentWepinUser
Retrieves information about the currently logged-in user in Wepin.
Parameters
None
Returns
<WepinUser>
status
<'success' | 'fail'>
The login statususerInfo
<UserInfo>
(optional) The user's information, including:userId
<String>
The user's IDemail
<String>
The user's emailprovider
<'google' | 'apple' | 'naver' | 'discord' | 'email' | 'external_token'>
The login provideruse2FA
<Boolean>
Whether the user uses two-factor authentication
walletId
<String>
The user's wallet IDuserStatus
<UserStatus>
(optional) The user's Wepin login status, including:loginStatus
<WepinLoginStatus - 'complete' | 'pinRequired' | 'registerRequired'>
If the user'sloginStatus
value is not 'complete', the user must register with Wepin.pinRequired
<Boolean>
Whether a PIN is required
token
<Token>
The user's Wepin tokenaccessToken
<String>
The access tokenrefreshToken
<String>
The refresh token
Exception
Example
logoutWepin
Logs out the currently logged-in user from Wepin.
Parameters
None
Returns
<Boolean>
Exception
Example
getSignForLogin
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 generationmessage
<String>
The message or payload to be signed
The key for signing can be obtained from Wepin Workspace. In the Development Tools menu, click Get your authentication key on the Login tab to retrieve the authentication key.
Returns
<String> - The generated signature
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 following document:
Exception
Example
finalize
Terminates the Wepin Login Library.
Parameters
None
Returns
None
Exception
Example
Wepin Error
Last updated