September 25, 2017

Passwordless Login

Many apps are required to register. As per a survey, many users are leaving apps just because they don’t remember passwords. Many users don’t enter the app as they don’t like the long registration process. Even If the app provides social login (like Facebook login), few users do not want to share their social account details with the apps.

Another survey tells that users are interested to register using their phone numbers as smart phone users are growing. So, the best way to get more users to any app is to provide sign up using either
  • Phone number
  • Or Email
  • Or Social logins like Facebook

Social login is a common implementation, many developers may already know how to implement. But if you want to authenticate using either of the first two methods, then Facebook is providing an SDK called Account Kit to register using just phone number or email.
Click here to know more details about Account Kit

August 8, 2017

Routing in Oracle JET

Routing is very useful in JET when we want to navigate between pages or modules. Following is the step-by-step procedure to configure the routing in Oracle JET.

·       Open main.js under sr/js folder
·       Search for function init() . By default, you see the below statements when you create a new project in this function

ko.applyBindings(new MainViewModel(), document.getElementById('globalBody'));
app.adjustContentPadding();

·       Replace these lines with the below statements in the function

oj.Router.sync().then(
                            function () {
                                // Bind your ViewModel for the content of the whole page body.
                                ko.applyBindings(app, document.getElementById('globalBody'));
                            },
                            function (error) {
                                oj.Logger.error('Error in root start: ' + error.message);
                            }
                    );
  
·       Open appController.js under src/js folder
·       In the function ControllerViewModel(), add the following code

self.router = oj.Router.rootInstance;      
                self.router.configure({
                    'home': {label: 'Home', isDefault: true},
                    'dashboard': {label: 'Dashboard'}
                });
                oj.Router.defaults['urlAdapter'] = new oj.Router.urlParamAdapter();
function mergeConfig(original) {
                    return $.extend(true, {}, original, {
                        'animation': oj.ModuleAnimations.switcher(switcherCallback)
                    });
                }

                self.moduleConfig = mergeConfig(self.router.moduleConfig);               

·       We need to configure all the pages for which we need to apply the routing. In the above code, observe the highlighted lines under self.router.configure(). Similarly, replace these pages with your pages
·       Open index.html under src folder. Copy and paste the below line under div tag with id "globalBody" where the routing will be applied

<div data-bind="ojModule: moduleConfig"></div>

·       Now the router is ready
·       Whenever you want to navigate to another page, then call the below method.
self.router.go(<page id>);
Ex: if you want to go to dashboard, then use self.router.go('dashboard');

June 20, 2017

Issue: REST web services are created in AppModule but disappeared

[JDev 12.1.3]

Issue:

I have created an ADF application in JDeveloper 12.1.3 in which I created restful web services in the app module for the business components. I created another ViewObject by custom sql query and added to app module and created rest services for it. Suddenly all my existing rest services are disappeared from the app module window and + button under REST tab is also disabled as shown in the below image. There is no error or alert shown.


I can see the xml files in the project structure but are not appeared in the AppModule window.

Solution:

While creating my new view object by sql , I have not given any key attribute and added it to app module. I rolled back my changes and created the same view object with a key attribute and created rest service for the same view object now and it worked. It added to the list of rest services in the app module and all are appeared.

When you create rest service to any VO, an xml file like below is created.
 "AppModule_<ResourceName>Resource.xml"

When you delete the REST service, this file will not be deleted. If you try to create REST service again with the same name, then also you face the above issue. So, check if this xml file is deleted from the project before creating new one.