Skip to content
Permalink
Browse files

Firebase UIを使用し、サインアップ/サインインを実装

  • Loading branch information...
h-sakano committed Dec 3, 2018
1 parent eb90af9 commit b01b4f0fa57ad7466a55e2b9688a6275efb15ce9
Showing with 60 additions and 0 deletions.
  1. +1 −0 package.json
  2. +5 −0 src/router.ts
  3. +42 −0 src/views/SignIn.vue
  4. +12 −0 yarn.lock
@@ -11,6 +11,7 @@
"dependencies": {
"bulma": "^0.7.2",
"firebase": "^5.6.0",
"firebaseui": "^3.4.1",
"vue": "^2.5.17",
"vue-class-component": "^6.0.0",
"vue-property-decorator": "^7.0.0",
@@ -21,5 +21,10 @@ export default new Router({
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ './views/About.vue'),
},
{
path: '/signin',
name: 'signin',
component: () => import('./views/SignIn.vue'),
},
],
})
@@ -0,0 +1,42 @@
<template>
<div class="sign-in">
<h1 class="title is-5">Sign in</h1>
<div id="firebaseui-auth-container"></div>
</div>
</template>

<script lang="ts">
import firebase from 'firebase/app'
import 'firebase/auth'
import firebaseui from 'firebaseui'
import 'firebaseui/dist/firebaseui.css'
import { Component, Vue } from 'vue-property-decorator'
@Component
export default class SignIn extends Vue {
private mounted () {
let ui = firebaseui.auth.AuthUI.getInstance()
if (!ui) {
ui = new firebaseui.auth.AuthUI(firebase.auth())
}
ui.start('#firebaseui-auth-container', {
signInFlow: 'redirect',
signInOptions: [
firebase.auth.GoogleAuthProvider.PROVIDER_ID,
firebase.auth.EmailAuthProvider.PROVIDER_ID,
{
provider: firebase.auth.PhoneAuthProvider.PROVIDER_ID,
defaultCountry: 'JP',
},
],
signInSuccessUrl: '/',
})
}
}
</script>

<style scoped>
.sign-in {
text-align: center;
}
</style>
@@ -2707,6 +2707,11 @@ detect-node@^2.0.3:
resolved "http://registry.npm.taobao.org/detect-node/download/detect-node-2.0.4.tgz#014ee8f8f669c5c58023da64b8179c083a28c46c"
integrity sha1-AU7o+PZpxcWAI9pkuBecCDooxGw=

dialog-polyfill@^0.4.7:
version "0.4.10"
resolved "https://registry.yarnpkg.com/dialog-polyfill/-/dialog-polyfill-0.4.10.tgz#c4ea68a0deed4abb59a6a2a025c548b278cd532e"
integrity sha512-j5yGMkP8T00UFgyO+78OxiN5vC5dzRQF3BEio+LhNvDbyfxWBsi3sfPArDm54VloaJwy2hm3erEiDWqHRC8rzw==

diff@^3.2.0:
version "3.5.0"
resolved "http://registry.npm.taobao.org/diff/download/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12"
@@ -3337,6 +3342,13 @@ firebase@^5.6.0:
"@firebase/polyfill" "0.3.3"
"@firebase/storage" "0.2.4"

firebaseui@^3.4.1:
version "3.4.1"
resolved "https://registry.yarnpkg.com/firebaseui/-/firebaseui-3.4.1.tgz#f440f1cc653d98f97caadf8f58f7d67b83d00fde"
integrity sha512-DKXSFKC2ryCjpbifpLXC/erXPR8v7aCyWMicRXO0m7GNj+cpQgw7L3XOwzgpyoLKOL1DhsJ0Qniwi5qvvRSbjQ==
dependencies:
dialog-polyfill "^0.4.7"

flush-write-stream@^1.0.0:
version "1.0.3"
resolved "http://registry.npm.taobao.org/flush-write-stream/download/flush-write-stream-1.0.3.tgz#c5d586ef38af6097650b49bc41b55fabb19f35bd"

0 comments on commit b01b4f0

Please sign in to comment.
You can’t perform that action at this time.