An example of how to implement firebase-auth in Polymer 1.0?

后端 未结 2 1819
暖寄归人
暖寄归人 2020-12-21 12:19

I\'m a bit lost on how to implement the firebase-auth element. Any examples would be appreciated, I haven\'t managed to find any yet.

Thanks

相关标签:
2条回答
  • 2020-12-21 12:49

    I ended up getting auth to work by adapting this example element by HackITtoday for my firebase urls. It's as simple as adding the element like:

    <hi9-login></hi9-login>
    
    0 讨论(0)
  • 2020-12-21 12:57

    On this question, Glenn Vandeuren posts the following:


    Element

    <!--
    @license
    Copyright (c) 2015 Glenn Vandeuren. All rights reserved.
    -->
    <link rel="import" href="../polymer/polymer.html">
    <link rel="import" href="../paper-button/paper-button.html">
    
    <dom-module id="login-button">
    
      <style>
        :host {
          display: block;
          box-sizing: border-box;
        }
      </style>
    
      <template>
        <paper-button raised>Login using <span>[[service]]</span></paper-button>
      </template>
    
    </dom-module>
    
    <script>
    
      Polymer({
    
        is: 'login-button',
    
        properties: {
          service: String
        },
    
        listeners: {
          'tap': '_handleTap'
        },
    
        _handleTap: function () {
          this.fire('login', this.service);
        }
    
      });
    
    </script>
    

    Index

    <html>
      <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
        <title>login-button Demo</title>
        <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
        <link rel="import" href="../login-button.html">
      </head>
      <body>
    
        <login-button service="google"></login-button>
        <login-button service="twitter"></login-button>
    
        <script>
          document.addEventListener('login', function(service) {
            // handleLogin();
            alert(service.detail);
          });
        </script>
    
      </body>
    </html>
    
    0 讨论(0)
提交回复
热议问题