How easy are Social Logins with Magic?

Without Magic

It may take weeks to research, then integrate each individual social provider. Your backend may also have to be configured specifically to support each one.

With Magic

All the complications are abstracted away and you can integrate login with Google, Facebook, Apple and more in less than a day. Add support for additional providers and keep your backend code unchanged.

In your app:

// Initiate Magic
const magic = new Magic(MAGIC_API_KEY, {
extensions: [new MagicOAuthExtension()], });

// Login with Google
const didToken = await magic.oauth.loginWithRedirect({
provider: "google",
redirectURI: `${window.location.origin}/callback`
});

// On the callback page
const result = await magic.oauth.getRedirectResult();

// The result value has the following interface
interface OAuthRedirectResult {
  magic: {
    idToken: string;
    userMetadata: MagicUserMetadata;
  },
  oauth: {
    provider: string;
    scope: string[];
    accessToken: string;
    userHandle: string;
    userInfo: ...;
  }
};

 

And in the dashboard:

Dashboad Social Login