Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hybrid Mobile Development with Ionic

You're reading from   Hybrid Mobile Development with Ionic Building highly interactive mobile apps

Arrow left icon
Product type Paperback
Published in Apr 2017
Publisher Packt
ISBN-13 9781785286056
Length 242 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Gaurav Saini Gaurav Saini
Author Profile Icon Gaurav Saini
Gaurav Saini
Arrow right icon
View More author details
Toc

Demonstrating authorization in Ionic

Let's now build an Ionic application that will handle both authentication and authorization. Authorization refers to rules that determine who is allowed to do what. Authentication and authorization are central parts of securing an application:

Authentication = login + password (who you are)

Authorization = permissions (what you are allowed to do)

In this section, we will see how we can secure views of the Ionic application that are login protected. We will be working on the following points:

  • HomePage will be public
  • ArticlesPage is protected and will only be accessed after login
  • Menu is also dynamically updated on auth status
  • LoginPage will be inaccessible once a user is loggedIn
  • Authorization header will be passed after login for each request

Let's start by creating the application and I have named it as ionic2-auth:

    $ ionic start ionic2-auth sidemenu -v2
$ ionic...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image