Function useOnlineIdentity

  • Returns useOnlineIdentityProps

    useOnlineIdentityProps

    Example

    const { create, isAuthenticationRequired, tokenExpiresInSeconds } = useOnlineIdentity();

    const onlineIdentity = create({appID: uuid(), enableDittoCloudSync: true});
    const ditto = new Ditto(onlineIdentity, '/path');

    ...
    ...

    return <button onClick={() => ditto.auth.loginWithToken('my-token', 'my-provider')}>Authenticate</button>

    A hook for creating OnlineDitto identity objects. For creating OnlinePlayground identities, use {@link useOnlinePlaygroundIdentity} instead.