Skip to main content
Unveilydocs

Social Login Bridge

Native social login bridge (Google, Apple, Kakao, Naver, Line, Meta)

Overview

The unveilyBridge.auth namespace lets you open a native social login window from your web page and receive the result. For social login SDK setup, refer to the Social Login Setup document.

Supported providers: google, apple, kakao, naver, line, meta

Minimum plan by provider

ProviderMin planBasicStandardPro
GoogleBasic✓✓✓
AppleBasic✓✓✓
KakaoStandard—✓✓
NaverStandard—✓✓
LineStandard—✓✓
Meta (Facebook)Pro——✓

Google and Apple are available from the Basic plan. Kakao / Naver / Line require Standard, and Meta requires Pro.


Readiness — unveilyGlueReady

window.unveilyBridge is registered before the page loads, but the auth namespace only becomes available after the glue script injects. If you call auth.* at mount time in an SPA, wait for the unveilyGlueReady event first. Calls made from a user gesture (e.g. a button click) don't need to wait — the glue is always ready by then.

window.addEventListener('unveilyGlueReady', () => {
  // From here, window.unveilyBridge.auth.* calls are safe.
}, { once: true });

Android / iOS Platform Differences

The JS API is identical on both Android and iOS. Only the native implementation per provider differs.

ProviderAndroidiOS
GoogleFirebase Auth (google-services.json) — returns idTokenFirebase Auth (GoogleService-Info.plist) — returns idToken
AppleFirebase Auth (apple.com provider) — returns Firebase idTokenNative Sign in with Apple — returns idToken + authorizationCode
KakaoKakao SDK✅ Supported
NaverNaver SDK⏳ Coming soon
LineLINE SDK✅ Supported
MetaFacebook SDK🧪 Beta

Apple Login

Apple login on Android is handled via the Firebase Auth apple.com provider and returns a Firebase idToken. (The old Web OAuth / custom callbackUrl model has been retired.) On iOS, Apple login uses native Sign in with Apple and returns an Apple-only authorizationCode in addition to the idToken.

iOS social login provider status (SDK v1.2.1)

On iOS, Apple · Google · Kakao · LINE are supported, Meta is in beta, and Naver is coming soon. Android supports all providers.

The SDK packages needed for social login and push (FCM) are bundled in the SDK package, so you only configure your keys (iOS: Xcode resolves the SPM packages on xcodegen generate; Android: Gradle fetches them automatically). The one exception is Naver on iOS, which has no official Swift Package and must be added via CocoaPods. For keys and console setup, see Social Login Setup.


API

socialLogin

Initiates social login. callback is the name string of the global function that will receive the result; if omitted, the default onSocialLoginResult is used. The positional form socialLogin(provider, callback) also works.

window.unveilyBridge.auth.socialLogin({
  provider: "google",   // "google" | "apple" | "kakao" | "naver" | "line" | "meta"
  callback: "onSocialLoginResult"
});

// The positional form works identically:
// window.unveilyBridge.auth.socialLogin("google", "onSocialLoginResult");

function onSocialLoginResult(result) {
  if (!result.success) {
    // Failure — { success:false, provider, error, requiredTier? }
    console.error("Login failed:", result.provider, result.error, result.requiredTier);
    return;
  }

  const { provider, uid, displayName, email, profileImage, idToken, accessToken } = result;

  // google/apple → idToken (Firebase); kakao/naver/line/meta → accessToken (provider OAuth).
  // A success result always has both keys; the one that doesn't apply is null.
  // Do not trust uid as-is — forward the token to your server to verify (see "Server-side token verification").
  sendToServer({ provider, idToken, accessToken });
}

Result is a JSON object

The callback receives a single JSON object as its argument, not a string. No JSON.parse() is needed.

Success response structure

{
  "success": true,
  "provider": "google",
  "uid": "firebase-or-provider-uid",
  "displayName": "John Doe",
  "email": "[email protected]",
  "profileImage": "https://...",
  "idToken": "eyJ...",
  "accessToken": null
}
  • A success result always includes both idToken and accessToken keys; the one that doesn't apply is null. (Failure results have neither.) — SDK v1.2.1+

  • Server-verification token by provider:

    ProvideridTokenaccessTokenServer verification
    Google / AppleFirebase ID tokennullVerify idToken with the Firebase Admin SDK
    KakaonullKakao access tokenKakao API
    NavernullNaver access tokenNaver API
    LinenullLINE access tokenLINE API
    MetanullFacebook access tokenGraph API
  • On iOS, Apple login additionally returns an Apple-only authorizationCode field.

  • These tokens are for server-side verification — always follow Server-side token verification below.

Failure response structure

{
  "success": false,
  "provider": "kakao",
  "error": "FEATURE_NOT_ALLOWED",
  "requiredTier": "standard"
}

requiredTier tells you the minimum plan needed when a login fails due to insufficient plan. Use it to drive an upgrade prompt in your UI.

logout

Logs out of the currently logged-in social account. The callback default is onSocialAuthResult.

window.unveilyBridge.auth.logout({
  provider: "kakao",
  callback: "onSocialAuthResult"
});

revoke

Disconnects the social account. (Use this for full account deletion from the app.) The callback default is onSocialAuthResult.

window.unveilyBridge.auth.revoke({
  provider: "google",
  callback: "onSocialAuthResult"
});

function onSocialAuthResult(result) {
  // { success, action: "logout" | "revoke", provider, error? }
  console.log(result.action, result.provider, result.success);
}

Error Codes

On a failed login / logout / revoke, the error field returns one of the following.

CodeMeaning
INVALID_PARAMSMissing or malformed required parameter
FEATURE_NOT_ALLOWEDProvider not permitted on the current plan (see requiredTier)
PROVIDER_DISABLEDThe provider is disabled in configuration
SDK_NOT_CONFIGUREDProvider SDK configuration missing (key / client ID, etc.)
SDK_NOT_READYThe provider SDK is not included in the app (e.g. using Naver on iOS without CocoaPods)
UNKNOWN_PROVIDERUnrecognized provider name
LOGIN_CANCELLEDUser dismissed the login window

Server-side Token Verification

Server verification is the security boundary

The SDK only returns tokens — actual account-takeover prevention is completed by your server's token verification. Always verify idToken (google/apple) and accessToken (kakao/naver/line/meta) against the provider on your server, and trust only the user id the provider returns (never the uid the web sent). Do not handle this on the client only.

After a successful social login, pass the received idToken (google/apple) to the server for verification. For kakao·naver·line·meta, verify the accessToken as described in Provider access token verification below.

// Express.js example
const { OAuth2Client } = require('google-auth-library');
const client = new OAuth2Client(process.env.GOOGLE_CLIENT_ID);

app.post('/api/auth/social', async (req, res) => {
  const { provider, idToken } = req.body;

  if (provider === 'google') {
    const ticket = await client.verifyIdToken({
      idToken,
      audience: process.env.GOOGLE_CLIENT_ID
    });
    const payload = ticket.getPayload();
    const user = await findOrCreateUser({ email: payload.email, name: payload.name });
    const sessionToken = generateSessionToken(user);
    res.json({ token: sessionToken, user });
  }
});
// ASP.NET Core example
[HttpPost("auth/social")]
public async Task<IActionResult> SocialLogin([FromBody] SocialLoginRequest request)
{
    if (request.Provider == "google")
    {
        var payload = await GoogleJsonWebSignature.ValidateAsync(request.IdToken,
            new GoogleJsonWebSignature.ValidationSettings {
                Audience = new[] { _config["Google:ClientId"] }
            });

        var user = await _userService.FindOrCreateAsync(payload.Email, payload.Name);
        var token = _tokenService.Generate(user);
        return Ok(new { token, user });
    }
    return BadRequest();
}
// Spring Boot example
@PostMapping("/api/auth/social")
public ResponseEntity<?> socialLogin(@RequestBody SocialLoginRequest request) {
    if ("google".equals(request.getProvider())) {
        GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder(
            new NetHttpTransport(), JacksonFactory.getDefaultInstance())
            .setAudience(Collections.singletonList(googleClientId))
            .build();

        GoogleIdToken idToken = verifier.verify(request.getIdToken());
        if (idToken != null) {
            GoogleIdToken.Payload payload = idToken.getPayload();
            User user = userService.findOrCreate(payload.getEmail(), (String) payload.get("name"));
            String token = tokenService.generate(user);
            return ResponseEntity.ok(Map.of("token", token, "user", user));
        }
    }
    return ResponseEntity.badRequest().build();
}
<?php
// PHP example (using google-api-php-client)
require_once 'vendor/autoload.php';

$client = new Google_Client(['client_id' => $_ENV['GOOGLE_CLIENT_ID']]);

$data = json_decode(file_get_contents('php://input'), true);
if ($data['provider'] === 'google') {
    $payload = $client->verifyIdToken($data['idToken']);
    if ($payload) {
        $user = findOrCreateUser($payload['email'], $payload['name']);
        $token = generateToken($user);
        echo json_encode(['token' => $token, 'user' => $user]);
    } else {
        http_response_code(401);
    }
}
<%
' Classic ASP example — verify the Google token with a server-side library
' or the Google tokeninfo endpoint.
Dim idToken, provider
idToken = Request.Form("idToken")
provider = Request.Form("provider")

If provider = "google" Then
    ' Call the Google tokeninfo API
    Dim url, http
    url = "https://oauth2.googleapis.com/tokeninfo?id_token=" & idToken
    Set http = Server.CreateObject("MSXML2.ServerXMLHTTP")
    http.Open "GET", url, False
    http.Send

    If http.Status = 200 Then
        ' Verification succeeded — handle the user
        Response.ContentType = "application/json"
        Response.Write "{""success"": true}"
    Else
        Response.Status = "401 Unauthorized"
    End If
End If
%>

Provider access token verification + app binding (kakao / naver / line / meta) — SDK v1.2.1+

kakao·naver·line·meta return an accessToken (a provider OAuth token). Your server must verify this token against the provider's API, and must also confirm the token was issued for your app. A profile lookup alone would accept tokens issued for other apps, enabling account takeover.

Provider① Confirm it's your app's token (app binding)② Get the user id
KakaoGET https://kapi.kakao.com/v1/user/access_token_info → app_id is your app IDGET https://kapi.kakao.com/v2/user/me → id
LINEGET https://api.line.me/oauth2/v2.1/verify?access_token=… → client_id is your channel ID, expires_in > 0GET https://api.line.me/v2/profile → userId
MetaGET https://graph.facebook.com/debug_token?input_token=…&access_token={appId}|{appSecret} → is_valid, app_id is your app IDuser_id in the same response
Naver(no public app-check API)GET https://openapi.naver.com/v1/nid/me → response.id

Handle login/signup using only the id the provider returns — never the uid the web sent.

Never store or log tokens

Do not store or log the idToken / accessToken used for verification. After verification, use only the user id returned by the provider for your session/account handling.

On this page