Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@paulbarre/vue-firebase
Advanced tools
Currently these are the supported features:
Plugin under development, a lot more to come in a close future (?).
Install the package into your Vue application:
npm i @paulbarre/vue-firebase firebase
Install the plugin into your application:
import Vue from 'vue'
import VueFirebasePlugin from '@paulbarre/vue-firebase'
const options = {
...
}
Vue.use(VueFirebasePlugin, options)
Currently the plugin recognizes the following options:
Name | Type | Default | Description |
---|---|---|---|
config | Object | See below | Firebase configuration |
firestore | Boolean|Object | false|empty | Sets up firestore into your application |
auth | Boolean | false | Sets up authentication into your application |
Firestore will be setup if firestore
is true or an object (empty or not).
The config
option is used to initialize the Firebase application.
Name | Type | Description |
---|---|---|
projectId | String | The ID you set to your firebase project. It is visible into the URL when you are on the Firebase console of your project, or it is visible into the project settings page. |
apiKey | String | API Key of your project. Access the project settings page on Firebase console to retrieve it. |
See the official documentation for further details.
Real world example, into a Vue app created with Vue CLI:
import Vue from 'vue'
import App from './App.vue'
import VueFirebasePlugin from '@paulbarre/vue-firebase'
const projectId = '<put your project id here>'
const apiKey = '<put your api key here>'
Vue.use(VueFirebasePlugin, {
firestore: true,
auth: true,
config: {
projectId,
apiKey
}
})
Vue.config.productionTip = false
new Vue({
render: function (h) { return h(App) },
}).$mount('#app')
project id
It is what you can see on the URL when you access your project with the Firebase console: https://console.firebase.google.com/u/0/project/<project-id>/overview
.
API key
This is a string mixing characters and numbers looking like: AIza62bf....
.
In order to setup Firestore into your application, it is imperative that you give the plugin config
parameters:
projectId
To configure Firestore, the plugin firestore
parameter has to be true or an object. As an object it accepts the following options:
Name | Type | Default | Description |
---|---|---|---|
enablePersistence | Boolean | false | Sets up offline persistence (official documentation) |
VueFirebasePlugin provides $firestore
attribute to your Vue components:
App.vue
<script>
export default {
name: 'app',
async mounted () {
const ref = this.$firestore.collection('<the collection you want to use>')
const snapshot = await ref.get()
snapshot.forEach(doc => {
console.log(doc.data())
})
}
}
</script>
For more information on how to use $firestore
, check at the official documentation.
In order to setup Authentication into your application, it is imperative that you give the plugin config
parameters:
apiKey
VueFirebasePlugin provides $auth
attribute to your Vue components to be able to use Firebase authentication methods. Basically it is mapping firebase.auth()
.
In addition, it provides a global computed property $logged
to check if the app is logged or not to Firebase.
Important
The plugin will automatically set the Firebase callback onAuthStateChanged
that will check the user current login. So it is not needed to make any call to the API when the app is refreshed, just looking at $logged
will tell if the app is logged in or not.
Real world example for signing in and signing out:
<template>
<div id="app">
<div><input placeholder="email" type="text" v-model="email"></div>
<div><input placeholder="password" type="password" v-model="password"></div>
<div><button @click="handleError(signIn)">Login with email</button></div>
<p class="error">{{ error }}</p>
<p>Am i logged: {{ $logged }}</p>
<div><button @click="handleError(signOut)">Sign out</button></div>
</div>
</template>
<script>
export default {
name: 'app',
data () {
return {
email: '',
password: '',
error: ''
}
},
methods: {
async handleError (fn) {
try {
await fn()
this.error = ''
} catch (error) {
this.error = error.message
}
},
async signIn () {
await this.$auth.signInWithEmailAndPassword(this.email, this.password)
},
async signOut () {
await this.$auth.signOut()
}
}
}
</script>
For more information on how to use $auth
, check at the official documentation.
Tested so far
FAQs
Vue plugin to easily setup Firebase API
The npm package @paulbarre/vue-firebase receives a total of 0 weekly downloads. As such, @paulbarre/vue-firebase popularity was classified as not popular.
We found that @paulbarre/vue-firebase 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.