메서드

Wepin Flutter Login Library에서 제공하는 메서드 입니다.

loginWithOauthProvider

await wepinLogin.loginWithOauthProvider({required String provider, required String clientId})

In-app 브라우저가 열리고 OAuth 제공자에 로그인합니다. Firebase 로그인 정보를 가져오려면 loginWithIdToken() 또는 loginWithAccessToken() 메서드를 호출해야 합니다.

Parameters

  • provider <String>

    OAuth 로그인 Provider (예: 'google', 'naver', 'discord', 'apple')

  • clientId <String>

    OAuth 로그인 Provider의 클라이언트 ID

Returns

  • Future<LoginOauthResult>

    • provider <String>

      사용된 OAuth Provider의 이름

    • token <String>

      accessToken (Provider가 "naver" 또는 "discord"일 경우) 또는 idToken (Provider가 "google" 또는 "apple"일 경우)

    • type <WepinOauthTokenType>

      OAuth 토큰의 유형 (예: idToken, accessToken)

Exception

Example

final user = await wepinLogin.loginWithOauthProvider(
  provider: "google",
  clientId: "your-google-client-id"
);

signUpWithEmailAndPassword

await wepinLogin.signUpWithEmailAndPassword({required String email, required String password, String? locale})

이메일과 비밀번호를 사용하여 Wepin Firebase에 가입합니다. 가입이 성공하면 Firebase 로그인 정보를 반환합니다.

Parameters

  • email <String>

    사용자 이메일

  • password <String>

    사용자 비밀번호

  • locale <String> optional

    인증 이메일의 언어 설정 (기본 값: "en")

Returns

  • Future<LoginResult>

    • provider <String>

      로그인에 사용된 Provider (이 경우, 'email')

    • token <WepinFBToken>

      • idToken <String>

        Wepin Firebase ID 토큰

      • refreshToken <String>

        Wepin Firebase refresh토큰

Exception

Example

final user = await wepinLogin.signUpWithEmailAndPassword(
  email: 'abc@defg.com', 
  password: 'abcdef123&'
);

loginWithEmailAndPassword

await wepinLogin.loginWithEmailAndPassword({required String email, required String password})

이메일과 비밀번호를 사용하여 Wepin Firebase에 로그인합니다. 로그인에 성공하면 Firebase 로그인 정보를 반환합니다.

Parameters

  • email <String> 사용자 이메일

  • password <String> 사용자 비밀번호

Returns

  • Future<LoginResult>

    • provider <String>

      로그인에 사용된 Provider (이 경우, 'email')

    • token <WepinFBToken>

      • idToken <String>

        Wepin Firebase ID 토큰

      • refreshToken <String>

        Wepin Firebase refresh토큰

Exception

Example

final user = await wepinLogin.loginWithEmailAndPassword(
  email: 'abc@defg.com', 
  password: 'abcdef123&'
);

loginWithIdToken

await wepinLogin.loginWithIdToken({required String idToken, required String sign})

외부 ID 토큰을 사용하여 Wepin Firebase에 로그인합니다. 로그인에 성공하면 Firebase 로그인 정보를 반환합니다.

Parameters

  • idToken <String> 로그인에 사용될 ID 토큰 값

  • sign <String> optional ID 토큰의 서명 값 (getSignForLogin()의 반환값)

    wepin_flutter_login_lib 0.0.5 버전 이상부터 서명(sign) 파라미터값이 optional로 변경되었습니다. Wepin Workspace에서 인증 키를 제거하면, 서명(sign) 값을 사용하지 않을 수 있습니다. (Wepin Workspace > Development Tools menu > Login tab > Auth Key> Delete)

    인증 키를 이전에 생성한 경우에만 인증 키 메뉴가 표시됩니다.

Returns

  • Future<LoginResult>

    • provider <String> 로그인에 사용된 Provider (이 경우, 'external_token')

    • token <WepinFBToken>

      • idToken <String>

        Wepin Firebase ID 토큰

      • refreshToken <String>

        Wepin Firebase refresh토큰

Exception

Example

final user = await wepinLogin.loginWithIdToken(
    idToken:'eyJHGciO....adQssw5c', 
    sign:'9753d4dc...c63466b9'
);

loginWithAccessToken

await wepinLogin.loginWithAccessToken({required String provider, required String accessToken, required String sign})

외부 Access 토큰을 사용하여 Wepin Firebase에 로그인합니다. 로그인에 성공하면 Firebase 로그인 정보를 반환합니다.

Parameters

  • provider <"naver"|"discord">

    Access 토큰을 발급한 Provider

  • accessToken <String>

    로그인에 사용될 Access 토큰 값

  • sign <String> optional

    Access 토큰의 서명 값 (returned value of getSignForLogin())

    wepin_flutter_login_lib 0.0.5 버전 이상부터 서명(sign) 파라미터값이 optional로 변경되었습니다. Wepin Workspace에서 인증 키를 제거하면, 서명(sign) 값을 사용하지 않을 수 있습니다.

    (Wepin Workspace > Development Tools menu > Login tab > Auth Key> Delete)

    인증 키를 이전에 생성한 경우에만 인증 키 메뉴가 표시됩니다.

Returns

  • Future<LoginResult>

    • provider <String>

      로그인에 사용된 Provider (in this case, 'external_token')

    • token <WepinFBToken>

      • idToken <String>

        Wepin Firebase ID 토큰

      • refreshToken <String>

        Wepin Firebase refresh토큰

Exception

Example

final user = await wepinLogin.loginWithAccessToken(
    provider: 'naver', 
    accessToken:'eyJHGciO....adQssw5c', 
    sign:'9753d4dc...c63466b9'
);

getRefreshFirebaseToken

await wepinLogin.getRefreshFirebaseToken()

현재 Wepin Firebase 토큰의 정보를 가져옵니다.

Parameters

  • None

Returns

  • Future<LoginResult>

    • provider <String> 로그인에 사용된 Provider

      <'google'|'apple'|'naver'|'discord'|'email'|'external_token'>

    • token <WepinFBToken>

      • idToken <String> Wepin Firebase ID 토큰

      • refreshToken <String> Wepin Firebase refresh토큰

Exception

Example

final user = await wepinLogin.getRefreshFirebaseToken();

loginFirebaseWithOauthProvider

await wepinLogin.loginFirebaseWithOauthProvider({required String provider, required String clientId})

해당 메서드는 loginWithOauthProvider(), loginWithIdToken(), loginWithAccessToken() 기능을 통합한 것입니다. 인앱 브라우저를 열어 지정된 OAuth 로그인 Provider를 통해 Wepin Firebase에 로그인 합니다. 성공적인 로그인 후 Firebase 로그인 정보를 반환합니다

이 메서드는 Wepin Workspace에서 인증 키를 삭제한 후에만 사용할 수 있습니다.

(Wepin Workspace > Development Tools menu > Login tab > Auth Key> Delete)

인증 키를 이전에 생성한 경우에만 인증 키 메뉴가 표시됩니다.

Supported Version 버전 0.0.5 이상에서 지원

Parameters

  • provider <String>

    OAuth 로그인 Provider (예: 'google', 'naver', 'discord', 'apple')

  • clientId <String>

    OAuth 로그인 Provider의 클라이언트 ID

Return Value

  • Future<LoginResult>

    • provider <String> 로그인에 사용된 Provider

      <'google'|'apple'|'naver'|'discord'|'email'|'external_token'>

    • token <WepinFBToken>

      • idToken <String> Wepin Firebase ID 토큰

        • refreshToken <String> Wepin Firebase refresh 토큰

Exception

Example

final user = await wepinLogin.loginFirebaseWithOauthProvider(
    provider:'apple', 
    clietId:'apple-client-id'
);

loginWepinWithOauthProvider

await wepinLogin.loginWepinWithOauthProvider({required String provider, required String clientId})

해당 메서드는 loginFirebaseWithOauthProvider()loginWepin() 기능을 통합한 것입니다. 인앱 브라우저를 열어 지정된 OAuth 로그인 Provider를 통해 Wepin에 로그인 합니다. 성공적인 로그인 후 Wepin 사용자 정보를 반환합니다.

이 메서드는 Wepin Workspace에서 인증 키를 삭제한 후에만 사용할 수 있습니다.

(Wepin Workspace > Development Tools menu > Login tab > Auth Key> Delete)

인증 키를 이전에 생성한 경우에만 인증 키 메뉴가 표시됩니다.

Supported Version 버전 0.0.5 이상에서 지원

Parameters

  • provider <String>

    OAuth 로그인 Provider (예: 'google', 'naver', 'discord', 'apple')

  • clientId <String>

    OAuth 로그인 Provider의 클라이언트 ID

Return Value

  • Future<WepinUser>

    • status <'success'|'fail'>

      로그인 상태

    • userInfo <WepinUserInfo>optional - 사용자의 정보

      • userId <String>

        사용자의 ID

      • email <String>

        사용자의 이메일

      • provider <'google'|'apple'|'naver'|'discord'|'email'|'external_token'>

        로그인 Provider

      • use2FA <bool>

        사용자가 이중 인증을 사용하는지 여부

      • walletId <String>

        사용자의 지갑 ID

    • userStatus <WepinUserStatus> -사용자의 Wepin 로그인 상태

      • loginStats <'complete' | 'pinRequired' | 'registerRequired'>

        사용자의 loginStatus 값이 'complete'가 아닌 경우, 사용자는 Wepin에 register해야 합니다.

      • pinRequired <bool>optional

        PIN이 필요한지 여부

    • token <Token>

      사용자의 Wepin 토큰

    • accessToken <String> Access token

    • refreshToken <String> Refresh token

Exception

Example

final userInfo = await wepinLogin.loginWepinWithOauthProvider(
  provider: 'google',
  clientId; 'google-client-id'
);

final userStatus = userInfo.userStatus;
if (userStatus.loginStatus == 'pinRequired' || userStatus.loginStatus == 'registerRequired') {
    // Wepin register
}

loginWepinWithIdToken

await wepinLogin.loginWepinWithIdToken({required String idToken, String? sign})

해당 메서드는 loginWithIdToken()loginWepin() 기능을 통합한 것입니다. loginWepinWithIdToken() 메서드는 외부 ID 토큰을 사용하여 Wepin 에 로그인 합니다. 성공적인 로그인 후 Wepin 사용자 정보를 반환합니다.

Supported Version 버전 0.0.5 이상에서 지원

Parameters

  • idToken <String> 로그인에 사용될 ID 토큰 값

  • sign <String>optional ID 토큰의 서명 값 (getSignForLogin()의 반환 값)

    Wepin Workspace에서 인증 키를 제거하면, 서명(sign) 값을 사용하지 않을 수 있습니다.

    (Wepin Workspace > Development Tools menu > Login tab > Auth Key> Delete)

    인증 키를 이전에 생성한 경우에만 인증 키 메뉴가 표시됩니다.

Return Value

  • Future<WepinUser>

    • status <'success'|'fail'>

      로그인 상태

    • userInfo <WepinUserInfo>optional - 사용자의 정보.

      • userId <String>

        사용자의 ID

      • email <String>

        사용자의 이메일

      • provider <'google'|'apple'|'naver'|'discord'|'email'|'external_token'>

        로그인 Provider

      • use2FA <bool>

        사용자가 이중 인증을 사용하는지 여부

      • walletId <String>

        사용자의 지갑 ID

    • userStatus <WepinUserStatus> -사용자의 Wepin 로그인 상태

      • loginStats <'complete' | 'pinRequired' | 'registerRequired'>

        사용자의 loginStatus 값이 'complete'가 아닌 경우, 사용자는 Wepin에 register해야 합니다.

      • pinRequired <bool>optional

        PIN이 필요한지 여부

    • token <Token>

      사용자의 Wepin 토큰

    • accessToken <String> Access token

    • refreshToken <String> Refresh token

Exception

Example

final userInfo = await wepinLogin.loginWepinWithIdToken(
  idToken:'eyJHGciO....adQssw5c',
);

final userStatus = userInfo.userStatus;
if (userStatus.loginStatus == 'pinRequired' || userStatus.loginStatus == 'registerRequired') {
    // Wepin register
}

loginWepinWithAccessToken

await wepinLogin.loginWepinWithAccessToken({required String provider, required String accessToken, String? sign})

해당 메서드는 loginWithAccessToken()loginWepin() 기능을 통합한 것입니다. loginWepinWithAccessToken() 메서드는 외부 액세스 토큰을 사용하여 Wepin 에 로그인 합니다. 성공적인 로그인 후 Wepin 사용자 정보를 반환합니다.

Supported Version 버전 0.0.5 이상에서 지원

Parameters

  • provider <"naver"|"discord">

    Access 토큰을 발급한 Provider

  • accessToken <String>

    로그인에 사용될 Access 토큰 값

  • sign <String> optional

    Access 토큰의 서명 값 (returned value of getSignForLogin())

    Wepin Workspace에서 인증 키를 제거하면, 서명(sign) 값을 사용하지 않을 수 있습니다.

    (Wepin Workspace > Development Tools menu > Login tab > Auth Key> Delete)

    인증 키를 이전에 생성한 경우에만 인증 키 메뉴가 표시됩니다.

Return Value

  • Future<WepinUser>

    • status <'success'|'fail'>

      로그인 상태

    • userInfo <WepinUserInfo>optional - 사용자의 정보

      • userId <String>

        사용자의 ID

      • email <String>

        사용자의 이메일

      • provider <'google'|'apple'|'naver'|'discord'|'email'|'external_token'>

        로그인 Provider

      • use2FA <bool>

        사용자가 이중 인증을 사용하는지 여부

      • walletId <String>

        사용자의 지갑 ID

    • userStatus <WepinUserStatus> -사용자의 Wepin 로그인 상태

      • loginStats <'complete' | 'pinRequired' | 'registerRequired'>

        사용자의 loginStatus 값이 'complete'가 아닌 경우, 사용자는 Wepin에 register해야 합니다.

      • pinRequired <bool>optional

        PIN이 필요한지 여부

    • token <Token>

      사용자의 Wepin 토큰

    • accessToken <String> Access token

    • refreshToken <String> Refresh token

Exception

Example

final userInfo = await wepinLogin.loginWepinWithAccessToken(
    provider: 'naver',
    accessToken:'eyJHGciO....adQssw5c',
);

final userStatus = userInfo.userStatus;
if (userStatus.loginStatus == 'pinRequired' || userStatus.loginStatus == 'registerRequired') {
    // Wepin register
}

loginWepinWithEmailAndPassword

await wepinLogin.loginWepinWithEmailAndPassword({required String email, required String password})

해당 메서드는 loginWithEmailAndPassword()loginWepin() 기능을 통합한 것입니다. loginWepinWithEmailAndPassword() 메서드는 제공된 이메일과 비밀번호를 사용하여 Wepin에 로그인 합니다. 성공적인 로그인 후 Wepin 사용자 정보를 반환합니다.

Supported Version 버전 0.0.5 이상에서 지원

Parameters

  • email <String> 사용자 이메일

  • password <String> 사용자 비밀번호

Return Value

  • Future<WepinUser>

    • status <'success'|'fail'>

      로그인 상태

    • userInfo <WepinUserInfo>optional - 사용자의 정보

      • userId <String>

        사용자의 ID

      • email <String>

        사용자의 이메일

      • provider <'google'|'apple'|'naver'|'discord'|'email'|'external_token'>

        로그인 Provider

      • use2FA <bool>

        사용자가 이중 인증을 사용하는지 여부

      • walletId <String>

        사용자의 지갑 ID

    • userStatus <WepinUserStatus> -사용자의 Wepin 로그인 상태

      • loginStats <'complete' | 'pinRequired' | 'registerRequired'>

        사용자의 loginStatus 값이 'complete'가 아닌 경우, 사용자는 Wepin에 register해야 합니다.

      • pinRequired <bool>optional

        PIN이 필요한지 여부

    • token <Token>

      사용자의 Wepin 토큰

    • accessToken <String> Access token

    • refreshToken <String> Refresh token

Exception

Example

final userInfo = await wepinLogin.loginWithEmailAndPassword(
    email: "abc@abc.com",
    password: "user_password"
);

final userStatus = userInfo.userStatus;
if (userStatus.loginStatus == 'pinRequired' || userStatus.loginStatus == 'registerRequired') {
    // Wepin register
}

loginWepin

await wepinLogin.loginWepin(LoginResult params) 

Wepin Firebase 토큰을 사용하여 사용자를 Wepin에 로그인합니다.

Parameters

  • params <LoginResult> Parameters from the return value of methods like loginWithEmailAndPassword(), loginWithIdToken(), or loginWithAccessToken().

Returns

  • Future<WepinUser>

    • status <'success'|'fail'>

      로그인 상태

    • userInfo <WepinUserInfo>optional - 사용자의 정보

      • userId <String>

        사용자의 ID

      • email <String>

        사용자의 이메일

      • provider <'google'|'apple'|'naver'|'discord'|'email'|'external_token'>

        로그인 Provider

      • use2FA <bool>

        사용자가 이중 인증을 사용하는지 여부

      • walletId <String>

        사용자의 지갑 ID

    • userStatus <WepinUserStatus> -사용자의 Wepin 로그인 상태

      • loginStats <'complete' | 'pinRequired' | 'registerRequired'>

        사용자의 loginStatus 값이 'complete'가 아닌 경우, 사용자는 Wepin에 register해야 합니다.

      • pinRequired <bool>optional

        PIN이 필요한지 여부

    • token <Token>

      사용자의 Wepin 토큰

    • accessToken <String> Access token

    • refreshToken <String> Refresh token

Exception

Example

final wepinLogin = WepinLogin(appId: 'appId', appKey: 'appKey');
await wepinLogin.init();
final res = await wepinLogin.loginWithOauthProvider(
provider: "google",
clientId: "your-google-client-id"
);

final sign = wepinLogin?.getSignForLogin(privateKey: privateKey, message: res!.token);
LoginResult? resLogin;
if(provider == 'naver' || provider == 'discord') {
  resLogin = await wepinLogin.loginWithAccessToken(provider: provider, accessToken: res!.token, sign: sign));
} else {
  resLogin = await wepinLogin.loginWithIdToken(idToken: res!.token, sign: sign));
}

final userInfo = await wepinLogin.loginWepin(resLogin);
final userStatus = userInfo.userStatus;
if (userStatus.loginStatus == 'pinRequired' || userStatus.loginStatus == 'registerRequired') {
    // Wepin register
}

getCurrentWepinUser

await wepinLogin.getCurrentWepinUser()

Wepin에 현재 로그인한 사용자의 정보를 가져옵니다.

Parameters

  • None

Returns

  • Future<WepinUser>

    • status <'success'|'fail'>

      로그인 상태

    • userInfo <WepinUserInfo>optional - 사용자의 정보

      • userId <String>

        사용자의 ID

      • email <String>

        사용자의 이메일

      • provider <'google'|'apple'|'naver'|'discord'|'email'|'external_token'>

        로그인 Provider

      • use2FA <bool>

        사용자가 이중 인증을 사용하는지 여부

      • walletId <String>

        사용자의 지갑 ID

    • userStatus <WepinUserStatus> -사용자의 Wepin 로그인 상태

      • loginStats <'complete' | 'pinRequired' | 'registerRequired'>

        사용자의 loginStatus 값이 'complete'가 아닌 경우, 사용자는 Wepin에 register해야 합니다.

      • pinRequired <bool>optional

        PIN이 필요한지 여부

    • token <Token>

      사용자의 Wepin 토큰

    • accessToken <String> Access token

    • refreshToken <String> Refresh token

Exception

Example

final userInfo = await wepinLogin.getCurrentWepinUser();
final userStatus = userInfo.userStatus;
if (userStatus.loginStatus == 'pinRequired' || userStatus.loginStatus == 'registerRequired') {
    // Wepin register
}

logout

await wepinLogin.logout()

Wepin에 로그인한 사용자를 로그아웃합니다.

Parameters

  • None

Returns

  • Future<bool>

Exception

Example

final result = await wepinLogin.logout();
if (result) {
  // Successfully logged out
}

getSignForLogin

발급자를 확인하기 위한 서명을 생성합니다. 주로 ID 토큰 및 Access 토큰과 같은 로그인 관련 정보를 위한 서명을 생성하는 데 사용됩니다.

final result = getSignForLogin({required String privateKey, required String message});

Parameters

  • privateKey <String> 서명 생성에 사용되는 인증 키

  • message <String> 서명될 메시지 또는 페이로드

서명에 사용할 키는 위핀 워크스페이스에서 발급 받을 수 있습니다. 개발 도구 메뉴에서 로그인 탭의 인증키 발급 받기를 클릭하여 인증키를 확인하세요.

Returns

  • <String> 생성된 서명

인증 키(privateKey)는 반드시 안전하게 보관되어야 하며, 외부에 노출되지 않도록 주의해야 합니다. 보안과 민감한 정보 보호를 위해 getSignForLogin() 메서드는 프론트엔드가 아닌 백엔드에서 실행하는 것이 권장됩니다. 서명 생성 방법에 대해서는 아래 문서를 참고하세요.

Example

final sign = getSignForLogin(
  privateKey: '0400112233445566778899001122334455667788990011223344556677889900', 
  message: 'idtokenabcdef'
);

final res = await wepinLogin.loginWithIdToken(
    idToken: 'eyJHGciO....adQssw5c', 
    sign: sign
);

finalize

await wepinLogin.finalize()

Wepin Login Library 를 종료합니다.

Parameters

  • None

Returns

  • Future<void>

Example

await wepinLogin.finalize();

WepinError

Error CodeError MessageError Description

invalidAppKey

"InvalidAppKey"

The Wepin app key is invalid.

invalidParameters `

"InvalidParameters"

One or more parameters provided are invalid or missing.

invalidLoginProvider

"InvalidLoginProvider"

The login provider specified is not supported or is invalid.

invalidToken

"InvalidToken"

The token does not exist.

invalidLoginSession

"InvalidLoginSession"

The login session information does not exist.

notInitialized

"NotInitialized"

The WepinLoginLibrary has not been properly initialized.

alreadyInitialized

"AlreadyInitialized"

The WepinLoginLibrary is already initialized, so the logout operation cannot be performed again.

userCancelled

"UserCancelled"

The user has cancelled the operation.

unknownError

"UnknownError"

An unknown error has occurred, and the cause is not identified.

notConnectedInternet

"NotConnectedInternet"

The system is unable to detect an active internet connection.

failedLogin

"FailedLogin"

The login attempt has failed due to incorrect credentials or other issues.

alreadyLogout

"AlreadyLogout"

The user is already logged out, so the logout operation cannot be performed again.

invalidEmailDomain

"InvalidEmailDomain"

The provided email address's domain is not allowed or recognized by the system.

failedSendEmail

"FailedSendEmail"

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.

requiredEmailVerified

"RequiredEmailVerified"

Email verification is required to proceed with the requested operation.

incorrectEmailForm

"incorrectEmailForm"

The provided email address does not match the expected format.

incorrectPasswordForm

"IncorrectPasswordForm"

The provided password does not meet the required format or criteria.

notInitializedNetwork

"NotInitializedNetwork"

The network or connection required for the operation has not been properly initialized.

requiredSignupEmail

"RequiredSignupEmail"

The user needs to sign up with an email address to proceed.

failedEmailVerified

"FailedEmailVerified"

The WepinLoginLibrary encountered an issue while attempting to verify the provided email address.

failedPasswordStateSetting

"FailedPasswordStateSetting"

Failed to set the password state. This error may occur during password management operations, potentially due to invalid input or system issues.

failedPasswordSetting

"failedPasswordSetting"

Failed to set the password. This could be due to issues with the provided password or internal errors during the password setting process.

existedEmail

"ExistedEmail"

The provided email address is already registered. This error occurs when attempting to sign up with an email that is already in use.

apiRequestError

"ApiRequestError"

There was an error while making the API request. This can happen due to network issues, invalid endpoints, or server errors.

incorrectLifecycleException

"IncorrectLifecycleException"

The lifecycle of the Wepin SDK is incorrect for the requested operation. Ensure that the SDK is in the correct state (e.g., initialized and login) before proceeding.

failedRegister

"FailedRegister"

Failed to register the user. This can occur due to issues with the provided registration details or internal errors during the registration process.

accountNotFound

"AccountNotFound"

The specified account was not found. This error is returned when attempting to access an account that does not exist in the Wepin.

nftNotFound

"NftNotFound"

The specified NFT was not found. This error occurs when the requested NFT does not exist or is not accessible within the user's account.

failedSend

"FailedSend"

Failed to send the required data or request. This error could be due to network issues, incorrect data, or internal server errors.

Last updated