---
title: "Authentication in Ionic Angular with Supabase"
description: "An Ionic Angular realtime messaging app built on Supabase demonstrates email/password signup and login, magic link authentication for web and native mobile, and route protection with Angular guards."
url: "https://swe.quest/articles/authentication-in-ionic-angular-with-supabase-d02eec9140b86035"
canonical: "https://supabase.com/blog/authentication-in-ionic-angular"
source: "Supabase"
published: "2022-11-08"
difficulty: "medium"
kind: "How-to"
reading_minutes: 33
tags: ["identity-auth","frontend","mobile","postgres","typescript"]
---

# Authentication in Ionic Angular with Supabase

A post on [Supabase](https://swe.quest/sources/supabase.md), published 2022-11-08, 33 min read, How-to. Original: [https://supabase.com/blog/authentication-in-ionic-angular](https://supabase.com/blog/authentication-in-ionic-angular)

## Summary

An Ionic Angular realtime messaging app built on Supabase demonstrates email/password signup and login, magic link authentication for web and native mobile, and route protection with Angular guards. The Postgres side defines users, groups and messages tables, adds Row Level Security policies so the public anon key is safe in the frontend, uses a security-definer trigger to copy new auth users into a public table, and publishes the messages table for realtime inserts. On the client, an AuthService wraps supabase.auth and tracks session state in an RxJS BehaviorSubject, loading the stored session with getUser() at startup because onAuthStateChange usually doesn't fire on app load. Most of the logic applies to any Angular web project.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Identity & auth](https://swe.quest/tags/identity-auth.md) (Security)
- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)
- [Mobile](https://swe.quest/tags/mobile.md) (Web & mobile)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [TypeScript](https://swe.quest/tags/typescript.md) (Languages)

## Prerequisites

- Angular basics
- RxJS observables
- SQL basics ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))

## Keywords

Supabase, Ionic, Angular, Row Level Security, magic link, RxJS

## Related posts

- [Building a Realtime Trello Board with Supabase and Angular](https://swe.quest/articles/building-a-realtime-trello-board-with-supabase-and-angular-8c67e5fbd416633e.md): Supabase · 2022-08-24 · Medium · 30 min read · PostgreSQL, Identity & auth, Real-time systems, Frontend, TypeScript
  A Trello-style board clone built on Supabase, Angular and Tailwind, with boards, lists and cards stored in Postgres tables.
- [supabase-js v2](https://swe.quest/articles/supabase-js-v2-f87cba2e3b41f9e9.md): Supabase · 2022-08-16 · Medium · 5 min read · JavaScript, TypeScript, API design, Identity & auth, PostgreSQL
  supabase-js v2 brings incremental quality-of-life changes over v1.
- [Flutter Authorization with RLS](https://swe.quest/articles/flutter-authorization-with-rls-f1170d28eed05738.md): Supabase · 2022-11-22 · Medium · 25 min read · PostgreSQL, Identity & auth, Mobile, Real-time systems
  Extends a basic Flutter real-time chat app into a 1-on-1 chat with authorization enforced by PostgreSQL Row Level Security on Supabase.
- [Supabase Auth: SSO, Mobile, and Server-side support](https://swe.quest/articles/supabase-auth-sso-mobile-and-server-side-support-6a2bc9b0f4a5ef26.md): Supabase · 2023-04-13 · Medium · 7 min read · Identity & auth, PostgreSQL, Multi-tenancy, Mobile
  Supabase Auth adds SAML 2.0 single sign-on, a PKCE authorization flow for server-side rendering and mobile apps, and native Sign in with Apple on iOS.
- [Supabase Auth: Identity Linking, Hooks, and HaveIBeenPwned integration](https://swe.quest/articles/supabase-auth-identity-linking-hooks-and-haveibeenpwned-integration-8ed59b21ef27e3e6.md): Supabase · 2023-12-14 · Medium · 5 min read · Identity & auth, PostgreSQL
  Supabase Auth adds four features: manual Identity Linking via linkIdentity()/unlinkIdentity() for OAuth identities, session controls (time-boxed sessions, inactivity timeouts, single session per user on Pro and above), leaked password protection using the HaveIBeenPwned Pwned Passwords API with configurable password requirements, and Auth Hooks.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
