Authentication
How to implement authentication in your project.
In this section we will explain to setup authentication in your project.
Use RestrictedRoute
Use RestrictedRoute to restrict the anonymous user from accessing any page which is only available for the authenticated user. This is fully explained in Defining New Route .
Redirect User to Dashboard after login
To redirect user to dashboard open src / routes / index.js
file and update following code with replace code:
Replace with
Authentication Methods
We are proving two authentication method and base structure of auth methed (Basic Auth) in this template.
Firebase
JWT Auth
Firebase
Firebase is one of authentication method which is implemented in this template.To enable this method for your project follow steps given below.
Configuring the App at Firebase official website In order to use Firebase authentication service, firstly you need to configure your app at the Firebase official website. By configuring, you will get some credentials, you need to add that credentials in the application.
Update Credentials To updated Firebase credentials, open config.js file placed at:
src/services/auth/firebase/config.js
In this file, you will find a constant object config which contains the credential properties, you need to add your credentials to those properties.Activate Firebase To activate Firebase open
src / @jumbo / constants / AppConstants.js
file and update value like below example.Now import Firebase in auth methods. Go to
src / services / auth /
and open index.js file. In this file import Firebase like below example:
JWT Auth
JWT auth is another auth method implemented in this template. To enable this method follow steps given below:
Setup Auth Server Very first step to enable JWT auth is setup your JWT auth server if not setup. We are providing laravel with JWT auth impletement in servers.zip file with this template when you buy Jumbo. You can use that laravel setup server if you not have JWT auth server.
Update Credentials To updated JWT Auth credentials, open config.js file placed at:
src/services/auth/jwt/config.js
In this file,update server user where your auth server is installed. see example:Activate JWT Auth To activate JWT Auth open
src / @jumbo / constants / AppConstants.js
file and update value like below example.Now import Firebase in auth methods. Go to
src / services / auth /
and open index.js file. In this file import JWT Auth like below example:
Basic Auth
Basic auth us a base structure for auth method. You can use it for your custom Auth method.
Last updated