Git Product home page Git Product logo

ionic-babelify-es6-kc's Introduction

Modularized Ionic ES6 tabs starter project with Keycloak

Based on kitbrennan90/ionic-babel-browserify-es6 but heavily modified. Uses ES6 with babelify as transpiler. Controllers and rest services are seperated into their own files with the help of ES6 export/import syntax. One controller/service per file. State definitions are also separated from app.js. Keycloak-js initializes before everything else and logs in the user by default. Auth interceptor is registered on $httpProvider, which injects an Authorization header with OAuth bearer token into every REST call. A real REST mock service is used instead of plain JavaScript mock. OAuth tokens are obviously not checked for validity by the mock server but if you had a real REST service with Keycloak adapter installed it would work out of the box.

Setup instructions

  1. Install Keycloak and register with an identity provider of your choice. I recommend exposing your Keycloak server on a public domain over HTTPS to avoid problems with identity provider integration and unexpected self-signed certificate troubles. https://keycloak.gitbooks.io/securing-client-applications-guide/content/v/2.1/topics/oidc/javascript-adapter.html
  2. in Keycloak admin console, create a public OAuth client. Set Valid redirect URI to http://* and Web Origins to * in order to avoid CORS and redirect problems during development.
  3. Place client's keycloak.json into www folder.
  4. Install fake REST server: npm install -g json-server and run it with json-server --host 0.0.0.0 --watch fakerest/db.json
  5. Change js/config.js with the correct API URL.
  6. gulp js and ionic serve

The resulting app is actually something you can start working with in a real world scenario, providing:

  • User login
  • Actual REST calls with correct Authorization header
  • modularized Angular files
  • ES6 support (aww yea!)

Additional changes like modularized state files and .tpl files for keycloak.json and config.js are possible but I think this is a good start as it is.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.