Skip to content
Docs and guides

Help Center

Step-by-step guides for every setting in App Studio.

Social Login

Updated

Native Sign in with Apple and Google, passed to your website session.

Enable a native plugin, configure its settings, then rebuild and install the app.
Native plugin changes require a new build. Follow this guide for the exact settings and supported methods.View full size
  • JavaScript: window.AppSorcerer.socialLogin
  • Plan: Essential — included in every plan
  • Platforms: Android apps today. iOS support arrives with iOS builds (coming soon).

Turn the plugin on in App Studio → Plugins, fill in its settings, then rebuild your app. Websites call it through the JavaScript bridge.

Settings

Studio labelTypeDefaultNotes
Google Web client IDtext–From Google Cloud Console → Credentials.
Apple Services ID (iOS)text–
Send the token to this pagetext–required

Setup

Google

  1. In Google Cloud Console, create (or reuse) an OAuth Web application client and paste its ID in Google Web client ID.
  2. Also create an Android OAuth client with your app's package name and the SHA-1 fingerprint of its signing key (shown in App Studio under Publish). Without it Google returns no account.

Apple (signs in through a secure browser tab)

  1. In Apple Developer, create a Services ID (the "Apple Services ID" setting) with Sign in with Apple enabled and your website's endpoint as the Return URL.
  2. That endpoint receives Apple's form_post (code, id_token, state, user). Verify the token, then redirect the browser to the returnUrl found in state (base64url JSON { nonce, returnUrl, provider }), passing the values along:
redirect.txt
302 → appsorcerer-auth://social-login/<your package name>/apple?id_token=…&code=…&state=…  (or ?error=…)

The app picks the result up from that link. Pass state back unchanged (also with error): the app only accepts a link for a sign-in it started in the last 10 minutes, with the same state and an Apple ID token for your Services ID and the app's nonce. Any other link is ignored.

JavaScript API

Every method returns a Promise. Call it as await AppSorcerer.socialLogin.<method>(args).

MethodArgumentsResolves with
signIn{ provider: 'google' | 'apple', redirect = true, nonce? } + provider options belowGoogle: { provider, idToken, id, email, name, givenName, familyName, picture, phoneNumber } · Apple: { provider, idToken, code, state, id, email, name, user }
signInWithGoogle / signInWithApplesame optionssame
signOut–null — clears Credential Manager's saved Google sign-in state
isAvailable–{ google, apple } (configured or not)

Google options: mode: 'button' (default, "Sign in with Google" sheet) or 'bottomSheet' (One Tap style), filterByAuthorizedAccounts, autoSelect, webClientId (overrides the setting). Apple options: redirectUri, clientId (overrides the Services ID), scope (default "name email").

With redirect (default true) and a callbackUrl set, the app then opens callbackUrl#provider=google&id_token=…&email=…&name=… — the token is in the URL fragment, so it never reaches server logs; read it with JavaScript.

Events

Listen with AppSorcerer.on('<event>', callback) (or the DOM event appsorcerer:<event>).

EventData
socialLogin.resultApple result (also emitted when the app was restarted while the user was in the browser)

Errors

Rejections carry error.code: canceled, no_credential, sign_in_failed, not_configured, no_browser, unavailable, invalid_args, unknown_method.

Example

JavaScript
const result = await AppSorcerer.socialLogin.signIn({ provider: 'google', redirect: false });
await fetch('/api/auth/google', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ idToken: result.idToken }),
});

Notes

  • Always verify ID tokens on your server (audience = your Web client ID or Services ID).
  • Closing the Apple sign-in tab without finishing rejects with canceled.
Was this helpful?