@8base/web-oauth-client 中文文档教程
8base api token auth client
AuthProvider
的 8base web oauth 客户端。
WebOAuthClient
Table of Contents
WebOAuthClient
创建 Web oauth 客户端的实例
Parameters
authorize
Function Function used to describe authorize logic.
Usage
Firebase oauth
import firebase from 'firebase';
import { WebOAuthClient } from '@8base/web-oauth-client';
const FIREBASE_CONFIGURATION = {
apiKey: "",
authDomain: "",
databaseURL: "",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: ""
};
const firebaseAuth = firebase.initializeApp(FIREBASE_CONFIGURATION).auth();
const authClient = new WebOAuthClient({
authorize (email, password) {
return firebaseAuth.signInWithEmailAndPassword(
email,
password,
)
.then(() => firebaseAuth.currentUser.getIdToken())
.then((token) => {
return token;
})
},
logout() {
window.addEventListener('unload', () => {
this.purgeState();
});
window.location.href = '/';
}
});
Examples
8base api token auth client
The 8base web oauth client for the AuthProvider
.
WebOAuthClient
Table of Contents
WebOAuthClient
Create instance of the web oauth client
Parameters
authorize
Function Function used to describe authorize logic.
Usage
Firebase oauth
import firebase from 'firebase';
import { WebOAuthClient } from '@8base/web-oauth-client';
const FIREBASE_CONFIGURATION = {
apiKey: "",
authDomain: "",
databaseURL: "",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: ""
};
const firebaseAuth = firebase.initializeApp(FIREBASE_CONFIGURATION).auth();
const authClient = new WebOAuthClient({
authorize (email, password) {
return firebaseAuth.signInWithEmailAndPassword(
email,
password,
)
.then(() => firebaseAuth.currentUser.getIdToken())
.then((token) => {
return token;
})
},
logout() {
window.addEventListener('unload', () => {
this.purgeState();
});
window.location.href = '/';
}
});
Examples
更多
你可能也喜欢
- 801matt-colors 中文文档教程
- @0xproject/sol-compiler 中文文档教程
- @0y0/git-delete-branch 中文文档教程
- @2600hz/js-utilities 中文文档教程
- @2plgiap/react-leaflet 中文文档教程
- @3kles/kles-selected-list 中文文档教程
- @__path/graph 中文文档教程
- @aappddeevv/graphql-codgen-scala 中文文档教程
- @aarnila/react-instagram-embed 中文文档教程
- @ab.progr/eslint-config-node-extended 中文文档教程