Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
aor-firebase-client2
Advanced tools
Readme
An admin-on-rest client for Firebase.
npm install aor-firebase-client --save
<Admin>
component// in src/App.js
import React from 'react';
import { Admin, Resource } from 'admin-on-rest';
import { RestClient } from 'aor-firebase-client';
const firebaseConfig = {
apiKey: '<your-api-key>',
authDomain: '<your-auth-domain>',
databaseURL: '<your-database-url>',
storageBucket: '<your-storage-bucket>',
messagingSenderId: '<your-sender-id>'
};
const clientOptions = {
timestampFieldNames: {
createdAt: 'createdAt',
updatedAt: 'updatedAt'
},
trackedResources: [{
name: 'posts', // The name reference to be used in all other places in AOR
path: 'blog', // The path in the database. If missing will use the name
public: true,
uploadFields: [] // The string name of the field
}, 'contacts'] // A single string assumes path and name as equal, non private and without upload fields
}
const App = () => (
<Admin restClient={RestClient(trackedResources, clientOptions)} >
<Resource name="posts" list={PostList} />
<Resource name="contacts" list={ContactList} />
</Admin>
);
export default App;
The package lets you manage the login/logout process implementing an optional authClient
prop of the Admin
component (see documentation).
It stores a firebaseToken
in localStorage
.
The configuration options available are:
userProfilePath
: The database path to user profiles. Defaults to /users/
. Mind the slashes.
userAdminProp
: The database key to point if a user has admin powers. Defaults to isAdmin
The final path is: {userProfilePath}/{uid}/{userAdminProp}
localStorageTokenName
: Local storage identifier to hold the firebase client token, defaults to aorFirebaseClientToken
handleAuthStateChange
: A way to override the auth process
// in src/App.js
...
import {RestClient, AuthClient} from 'aor-firebase-client';
const firebaseConfig = {
apiKey: '<your-api-key>',
authDomain: '<your-auth-domain>',
databaseURL: '<your-database-url>',
storageBucket: '<your-storage-bucket>',
messagingSenderId: '<your-sender-id>'
};
const authConfig = {
userProfilePath: 'profiles',
userAdminProp: 'superuser'
}
const App = () => (
<Admin restClient={RestClient(firebaseConfig)} authClient={AuthClient(authConfig)}>
<Resource name="posts" list={PostList} />
</Admin>
);
export default App;
Note: AuthClient does require using the RestClient in order to initialize firebase. Alternatively, you can opt to not use the RestClient and initialize firebase yourself like this:
import {RestClient, AuthClient} from 'aor-firebase-client';
import firebase from 'firebase';
const firebaseConfig = {
apiKey: '<your-api-key>',
authDomain: '<your-auth-domain>',
databaseURL: '<your-database-url>',
storageBucket: '<your-storage-bucket>',
messagingSenderId: '<your-sender-id>'
};
firebase.initializeApp(firebaseConfig);
const App = () => (
<Admin authClient={AuthClient()}>
<Resource name="posts" list={PostList} />
</Admin>
);
export default App;
This library is licensed under the MIT Licence.
FAQs
Firebase Client for Admin On Rest
The npm package aor-firebase-client2 receives a total of 1 weekly downloads. As such, aor-firebase-client2 popularity was classified as not popular.
We found that aor-firebase-client2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.