├── .gitignore ├── LICENSE ├── README.md ├── bower.json ├── images ├── favicon.ico └── manifest │ ├── icon-144x144.png │ ├── icon-192x192.png │ ├── icon-48x48.png │ ├── icon-512x512.png │ ├── icon-72x72.png │ └── icon-96x96.png ├── index.html ├── manifest.json ├── polymer.json ├── service-worker.js ├── src ├── app-data.html ├── home-quotes.html ├── log-out.html ├── my-app.html ├── my-icons.html ├── not-found.html ├── register-login.html ├── secret-quotes.html └── shared-styles.html ├── sw-precache-config.js └── test ├── home-quotes.html ├── index.html └── my-home.html /.gitignore: -------------------------------------------------------------------------------- 1 | bower_components/ 2 | build/ 3 | node_modules/ 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Auth0 Blog Samples 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Build a Polymer App - From Authentication to Calling an API 2 | 3 | Build your first Polymer web app. Call an API and authenticate with [JSON Web Tokens](http://jwt.io) and local storage. Read the full tutorial here: [Build Your First App with Polymer and Web Components](https://auth0.com/blog/build-your-first-app-with-polymer-and-web-components/). 4 | 5 | ## Dependencies 6 | 7 | * [Node.js](http://nodejs.org) 8 | * [Bower](http://bower.io) `npm install bower -g` 9 | * [nodejs-jwt-authentication-sample](https://github.com/auth0-blog/nodejs-jwt-authentication-sample) 10 | 11 | ## Setup 12 | 13 | 1. Install the Polymer CLI: `npm install -g polymer-CLI` 14 | 2. Clone this repo into the folder of your choice 15 | 3. Run `bower install` to install Bower components 16 | 4. Clone [nodejs-jwt-authentication-sample](https://github.com/auth0-blog/nodejs-jwt-authentication-sample) into a different directory 17 | 5. Serve the API via `node server.js`; runs on [http://localhost:3001](http://localhost:3001) 18 | 6. Serve the Polymer project from the project folder: `polymer serve` (can be accessed in browser at [http://localhost:8080](http://localhost:8080), or add the `--open` flag to auto-launch in your default browser) 19 | 20 | ## What is Auth0? 21 | 22 | Auth0 helps you to: 23 | 24 | * Add authentication with [multiple authentication sources](https://docs.auth0.com/identityproviders), either social like **Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce, amont others**, or enterprise identity systems like **Windows Azure AD, Google Apps, Active Directory, ADFS or any SAML Identity Provider**. 25 | * Add authentication through more traditional **[username/password databases](https://docs.auth0.com/mysql-connection-tutorial)**. 26 | * Add support for **[linking different user accounts](https://docs.auth0.com/link-accounts)** with the same user. 27 | * Support for generating signed [Json Web Tokens](https://docs.auth0.com/jwt) to call your APIs and **flow the user identity** securely. 28 | * Analytics of how, when and where users are logging in. 29 | * Pull data from other sources and add it to the user profile, through [JavaScript rules](https://docs.auth0.com/rules). 30 | 31 | ## Create a free Auth0 account 32 | 33 | 1. Go to [Auth0](https://auth0.com/signup). 34 | 2. Use Google, GitHub or Microsoft Account to log in. 35 | 36 | ## Issue Reporting 37 | 38 | If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues. 39 | 40 | ## Author 41 | 42 | [Auth0](auth0.com) 43 | 44 | ## License 45 | 46 | This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info. 47 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chuck-norris-quotes", 3 | "authors": [ 4 | "Auth0" 5 | ], 6 | "private": true, 7 | "dependencies": { 8 | "app-layout": "PolymerElements/app-layout#^0.10.0", 9 | "app-route": "PolymerElements/app-route#^0.9.0", 10 | "iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0", 11 | "iron-icon": "PolymerElements/iron-icon#^1.0.0", 12 | "iron-iconset-svg": "PolymerElements/iron-iconset-svg#^1.0.0", 13 | "iron-input": "PolymerElements/iron-input#^1.0.10", 14 | "iron-localstorage": "PolymerElements/iron-localstorage#^1.0.0", 15 | "iron-media-query": "PolymerElements/iron-media-query#^1.0.0", 16 | "iron-pages": "PolymerElements/iron-pages#^1.0.0", 17 | "iron-selector": "PolymerElements/iron-selector#^1.0.0", 18 | "paper-icon-button": "PolymerElements/paper-icon-button#~1.1.0", 19 | "polymer": "Polymer/polymer#^1.6.0", 20 | "iron-ajax": "PolymerElements/iron-ajax#^1.4.3", 21 | "paper-input": "PolymerElements/paper-input#^1.1.18", 22 | "paper-button": "PolymerElements/paper-button#^1.0.13" 23 | }, 24 | "devDependencies": { 25 | "web-component-tester": "^4.0.0" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0-blog/polymer-with-jwt-api/62b98ac1c9d72df8dbac4b179254cd4919236a2b/images/favicon.ico -------------------------------------------------------------------------------- /images/manifest/icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0-blog/polymer-with-jwt-api/62b98ac1c9d72df8dbac4b179254cd4919236a2b/images/manifest/icon-144x144.png -------------------------------------------------------------------------------- /images/manifest/icon-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0-blog/polymer-with-jwt-api/62b98ac1c9d72df8dbac4b179254cd4919236a2b/images/manifest/icon-192x192.png -------------------------------------------------------------------------------- /images/manifest/icon-48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0-blog/polymer-with-jwt-api/62b98ac1c9d72df8dbac4b179254cd4919236a2b/images/manifest/icon-48x48.png -------------------------------------------------------------------------------- /images/manifest/icon-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0-blog/polymer-with-jwt-api/62b98ac1c9d72df8dbac4b179254cd4919236a2b/images/manifest/icon-512x512.png -------------------------------------------------------------------------------- /images/manifest/icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0-blog/polymer-with-jwt-api/62b98ac1c9d72df8dbac4b179254cd4919236a2b/images/manifest/icon-72x72.png -------------------------------------------------------------------------------- /images/manifest/icon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0-blog/polymer-with-jwt-api/62b98ac1c9d72df8dbac4b179254cd4919236a2b/images/manifest/icon-96x96.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Chuck Norris Quotes 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 94 | 95 | 96 | 97 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Chuck Norris Quotes", 3 | "short_name": "Chuck Norris", 4 | "start_url": "/?homescreen=1", 5 | "display": "standalone", 6 | "theme_color": "#3f51b5", 7 | "background_color": "#3f51b5", 8 | "icons": [ 9 | { 10 | "src": "images/manifest/icon-192x192.png", 11 | "sizes": "192x192", 12 | "type": "image/png" 13 | }, 14 | { 15 | "src": "images/manifest/icon-512x512.png", 16 | "sizes": "512x512", 17 | "type": "image/png" 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /polymer.json: -------------------------------------------------------------------------------- 1 | { 2 | "entrypoint": "index.html", 3 | "shell": "src/my-app.html", 4 | "fragments": [ 5 | "src/home-quotes.html", 6 | "src/register-login.html", 7 | "src/secret-quotes.html", 8 | "src/not-found.html" 9 | ], 10 | "sourceGlobs": [ 11 | "src/**/*", 12 | "images/**/*", 13 | "bower.json" 14 | ], 15 | "includeDependencies": [ 16 | "manifest.json", 17 | "bower_components/webcomponentsjs/webcomponents-lite.min.js" 18 | ] 19 | } -------------------------------------------------------------------------------- /service-worker.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2016 The Polymer Project Authors. All rights reserved. 4 | * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | * Code distributed by Google as part of the polymer project is also 8 | * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | console.info('Service worker disabled for development, will be generated at build time.'); 11 | -------------------------------------------------------------------------------- /src/app-data.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 57 | -------------------------------------------------------------------------------- /src/home-quotes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 30 | 31 | 42 | 43 | -------------------------------------------------------------------------------- /src/log-out.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 34 | 35 | 55 | 56 | -------------------------------------------------------------------------------- /src/my-app.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 111 | 112 | 146 | 147 | -------------------------------------------------------------------------------- /src/my-icons.html: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/not-found.html: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 24 | 25 | 30 | 31 | -------------------------------------------------------------------------------- /src/register-login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 84 | 85 | 141 | 142 | -------------------------------------------------------------------------------- /src/secret-quotes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 43 | 44 | 67 | 68 | -------------------------------------------------------------------------------- /src/shared-styles.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 46 | 47 | -------------------------------------------------------------------------------- /sw-precache-config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2016 The Polymer Project Authors. All rights reserved. 4 | * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | * Code distributed by Google as part of the polymer project is also 8 | * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | module.exports = { 11 | staticFileGlobs: [ 12 | '/index.html', 13 | '/manifest.json', 14 | '/bower_components/webcomponentsjs/webcomponents-lite.min.js' 15 | ], 16 | navigateFallback: '/index.html' 17 | }; 18 | -------------------------------------------------------------------------------- /test/home-quotes.html: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | home-quotes 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 30 | 31 | 32 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /test/index.html: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Tests 18 | 19 | 20 | 21 | 22 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /test/my-home.html: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | my-home 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 30 | 31 | 32 | 46 | 47 | 48 | --------------------------------------------------------------------------------