I need a guide for Auth0 for Ionic with non-authenticated and authenticated pages of the app

Hi to you all,

I am new to auth0 and I tried it out for a mobile app I am building. I am looking for a guide (best solution) to this scenario:

  • Problem:
    Implementing authentication/authorization for an ionic (4 or 3) mobile app that requires login only for a specific type of users, in other words app has public and private pages that require authentication.

  • What I have:
    Ionic 4 app connecting to Rest API (nodejs8.10 + lambda + dynamoDb + serverless framework)

  • Issue:
    The guides I see there, including the official ( 01-Login) sample, they approach it as if register/login is going to happen before the landing page of the app. Is there any other guides/videos that show how to integrate with auth0 but do it when you want it, like when some pages are going to be visited?

For more details, could there be another way of like having auth0 api endpoints like /auth/register and /auth/login and GET - /auth/user that will return the user token after successful authentication? Not to have to configure call back urls etc…?

I am just throwing ideas out there, let me know where am wrong or what is the best approach here… Like if did not want to do things like the last 2 lines here that the official guide tells me to put . in my app.component.ts but instead put it in the component where I need login, will it work?

platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.

  // Redirect back to app after authenticating
  (window as any).handleOpenURL = (url: string) => {

That was too much but let me know.
Thanks a lot.