At the end of this class, you will be able to:
wilson-espina/jsd-9-resources repo to your computerDocuments/JSD/jsd-9-resources/17-deploying-your-app
UPDATE
Key Objective
Type of Exercise
Timing
10mins |
|
// Your web app's Firebase configuration
var firebaseConfig = {
// Your app's config properties
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
// Connect to our Firebase app using the reference URL
const db = firebase.database();
// Add authentication ref
const authRef = firebase.auth();
const provider = new firebase.auth.GoogleAuthProvider();
authRef.signInWithPopup(provider)
.then(() => {
// handle signed in state
});
.catch(error => {
console.error(error);
});
Sign-in
Key Objective
Type of Exercise
Timing
10mins |
|
$).
{
"rules": {
".read": true,
".write": true
}
}
{
"rules": {
".read": true,
".write": "auth != null"
}
}
auth object relates to the current user.
{
"rules": {
".read": true,
"messages": {
".write": "auth != null && !data.exists() ||
(auth != null && data.exists() && data.child('uid').val() == auth.uid)",
"$votesId": {
".write": "auth != null"
}
}
}
}
{
"rules": {
".read": true,
"messages": {
".write": "auth != null && !data.exists() ||
(auth != null && data.exists() && data.child('uid').val() == auth.uid)",
auth != null AND you are creating a new doc !data.exists() data.exists(), then the id you are currently logged in with auth.uid must match the id of the uid field in the data you are trying to update data.child('uid').val().
"$votesId": {
".write": "auth != null"
}
$votesId is the wildcard location for all votes.
Type of Exercise
Timing
8mins |
|
Get Started.Continue.firebase login command.firebase init command.
Firebase
master branch.
Github Pages
npm install --global surge
surge
Surge
(Lesson #17)