0

I am developing a mobile application with NativeScript & Vue (Ts) and I am questioning myself!

I have to develop the login page & the login process for the mobile app and I really don't know which choice is the better. I need to communicate between My App and My Website which have the exact same purpose. Plus I expect my user to keep logged after first login on the app.

  • I started to think to give access to the data on my website by developing a REST API (API Platform + Symfony + JWT Token).
  • Now I think of using OAuth2 for the exchange (get token, get refreshtoken etc...).
  • Now I wonder should I just send an HTTPS POST Request and generate tokens by myself?

Has anyone done this before?
Have you any suggestions?
Also which process is the better in my case: Implicit Grant or Password Grant?

Thanks!

1 Answer 1

1

I would highly recommend Firebase Authentication. There is core support for Firebase Authentication in Nativescript, found here: https://docs.nativescript.org/plugins/firebase-auth.html#authentication

It's very simple to set up:

import { firebase } from '@nativescript/firebase-core'
import '@nativescript/firebase-auth' // only needs to be imported 1x

const auth = firebase().auth()

An example of logging in:

firebase.firebase
.login({ type: firebase.firebase.LoginType.GOOGLE })
.then(() => {
    this.loadUser();
});

From there, I would use the Firebase permissions to handle user permissions. That's a bit outside the scope of the question, but I personally use custom claims to handle different permission levels (https://firebase.google.com/docs/auth/admin/custom-claims).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.