mirror of
https://github.com/zhigang1992/firecms.git
synced 2026-06-14 09:38:59 +08:00
1.1 KiB
1.1 KiB
id, title, sidebar_label
| id | title | sidebar_label |
|---|---|---|
| use_auth_controller | useAuthController | useAuthController |
:::note
Please note that in order to use these hooks you must be in
a component (you can't use them directly from a callback function).
Anyhow, callbacks usually include a FireCMSContext, which includes all
the controllers.
:::
useAuthController
For state and operations regarding authentication.
The props provided by this context are:
userThe Firebase user currently logged in or nullauthProviderErrorError dispatched by the auth providerauthLoadingIs the login process ongoingloginSkippedIs the login skippednotAllowedErrorThe current user was not allowed accessskipLogin()Skip loginsignOut()Sign out
Example:
import React from "react";
import { useAuthController } from "dist/index";
export function ExampleCMSView() {
const authController = useAuthController();
return (
authController.user ?
<div>Logged in as {authController.user.displayName}</div>
:
<div>You are not logged in</div>
);
}