ProviderId 에 대한 OAuthCredential을 생성하는 공급자 .페이스북.
서명:
export declare class FacebookAuthProvider extends BaseOAuthProvider
확장: BaseOAuthProvider
생성자
건설자 | 수정자 | 설명 |
---|---|---|
(건설자)() | FacebookAuthProvider 클래스의 새 인스턴스를 생성합니다. |
속성
재산 | 수정자 | 유형 | 설명 |
---|---|---|---|
FACEBOOK_SIGN_IN_METHOD | static | '페이스북닷컴' | 항상 SignInMethod 로 설정 .페이스북. |
PROVIDER_ID | static | '페이스북닷컴' | 항상 ProviderId 로 설정 .페이스북. |
행동 양식
방법 | 수정자 | 설명 |
---|---|---|
자격 증명(accessToken) | static | Facebook에 대한 자격 증명을 만듭니다. |
자격 증명FromError(오류) | static | 로그인, 링크 또는 재인증 작업 중에 발생한 AuthError 에서 기본 OAuthCredential을 추출하는 데 사용됩니다. |
credentialFromResult(userCredential) | static | UserCredential 에서 기본 OAuthCredential을 추출하는 데 사용됩니다. . |
FacebookAuthProvider.(생성자)
FacebookAuthProvider
클래스의 새 인스턴스를 생성합니다.
서명:
constructor();
FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD
항상 SignInMethod 로 설정 .페이스북.
서명:
static readonly FACEBOOK_SIGN_IN_METHOD: 'facebook.com';
FacebookAuthProvider.PROVIDER_ID
항상 ProviderId 로 설정 .페이스북.
서명:
static readonly PROVIDER_ID: 'facebook.com';
FacebookAuthProvider.credential()
Facebook에 대한 자격 증명을 만듭니다.
서명:
static credential(accessToken: string): OAuthCredential;
매개변수
매개변수 | 유형 | 설명 |
---|---|---|
액세스토큰 | 끈 | 페이스북 액세스 토큰. |
보고:
예
// `event` from the Facebook auth.authResponseChange callback.
const credential = FacebookAuthProvider.credential(event.authResponse.accessToken);
const result = await signInWithCredential(credential);
FacebookAuthProvider.credentialFromError()
로그인, 링크 또는 재인증 작업 중에 발생한 AuthError 에서 기본 OAuthCredential을 추출하는 데 사용됩니다.
서명:
static credentialFromError(error: FirebaseError): OAuthCredential | null;
매개변수
매개변수 | 유형 | 설명 |
---|---|---|
오류 | Firebase오류 |
보고:
OAuth 자격 증명 | 없는
FacebookAuthProvider.credentialFromResult()
UserCredential 에서 기본 OAuthCredential을 추출하는 데 사용됩니다. .
서명:
static credentialFromResult(userCredential: UserCredential): OAuthCredential | null;
매개변수
매개변수 | 유형 | 설명 |
---|---|---|
사용자 자격 증명 | 사용자 자격 증명 | 사용자 자격 증명. |
보고:
OAuth 자격 증명 | 없는
실시예 1
// Sign in using a redirect.
const provider = new FacebookAuthProvider();
// Start a sign in process for an unauthenticated user.
provider.addScope('user_birthday');
await signInWithRedirect(auth, provider);
// This will trigger a full page redirect away from your app
// After returning from the redirect when your app initializes you can obtain the result
const result = await getRedirectResult(auth);
if (result) {
// This is the signed-in user
const user = result.user;
// This gives you a Facebook Access Token.
const credential = FacebookAuthProvider.credentialFromResult(result);
const token = credential.accessToken;
}
실시예 2
// Sign in using a popup.
const provider = new FacebookAuthProvider();
provider.addScope('user_birthday');
const result = await signInWithPopup(auth, provider);
// The signed-in user info.
const user = result.user;
// This gives you a Facebook Access Token.
const credential = FacebookAuthProvider.credentialFromResult(result);
const token = credential.accessToken;