0.1.0 • Published 3 years ago

@coocaa/auth-front-lib v0.1.0

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

auth-front

Project setup

npm install @coocaa/auth-front-lib

setup

import Vue from 'vue'
import * as auth from '@coocaa/auth-front'

const firebaseConfig = {
  apiKey: "xxxxxxxxxxxxxxxxxxx",
  authDomain: "xxxxxxxx.firebaseapp.com",
  databaseURL: "https://xxxxxxxx.firebaseio.com",
  projectId: "xxxxxxxxx",
  storageBucket: "xxxxxxxxx.appspot.com",
  messagingSenderId: "xxxxxxxxxxxxx",
  appId: "x:xxxxxxxxxxxxx:web:xxxxxxxxxxxxxxxxx",
  measurementId: "x-xxxxxxxxx"
};

Vue.use(auth, firebaseConfig)

usage

in any component you have access to those method and attributes

this.$user: {uid: string}
this.$logout()
this.$getFirebaseToken(id: string): Promise<string> // you must be logged in before using this
this.$getProfilTag(id: string): Promise<string>
this.$setProfilName(name: string): Promise<null> // you must be logged in before using this
this.$getProfilName(id: string): Promise<string>
this.$setProfilBio(bio: string): Promise<null> // you must be logged in before using this
this.$getProfilBio(id: string): Promise<string>
this.$setProfilPictureUrl(url: string): Promise<null> // you must be logged in before using this
this.$getProfilPictureUrl(id: string): Promise<string>
this.$setProfilBannerUrl(url: string): Promise<null> // you must be logged in before using this
this.$getProfilBannerUrl(id: string): Promise<string>

or get the token by the plugin directly (you must install the plugin before anyway)

import { getFirebaseToken } from '@coocaa/auth-front'

getFirebaseToken(): Promise<string> // you must be logged in before using this