weixin_33720452 2015-12-22 08:40 采纳率: 0%
浏览 90

在Cordova中访问数据库

I am very new to cordova developing. I am trying to develop one login page in android app, i need to access username and password from database for checking credential. Now i am hosting one web service and just pass the user name and password to that service using ajax request and proceed based on value returned from webservice. I dont know is this the correct procedure?. I am sending user name and password through ajax post, i think its insecure.Can you please suggest the best wasy to access database in cordova? I am using visual studio IDE for developing. I used following code to send username and pwd to webservice.

$.ajax({
    url: 'localhost\service\Controller',// hostedd in iis
    data: JSON.stringify({ username: 'user1', password: 'pwd' }),
    sucess: function (data) {
        //perform operation for login success
    },
    error: function () {

    }
})

Thanks

  • 写回答

1条回答 默认 最新

  • 乱世@小熊 2015-12-22 09:16
    关注

    Follow these steps:

    1. If you use external urls, then white listen them: http://cordova.apache.org/docs/en/dev/guide/appdev/whitelist/index.html

    2. Use only https.

    3. Verify the footprint of your cert by using this plugin:

    http://plugreg.com/plugin/EddyVerbruggen/SSLCertificateChecker-PhoneGap-Plugin

    1. Don't send the password, send the hash of the password. Use the same algorithm which you use in the backend for creating the hash.

    2. Create a device UUID, save it on the device and send it to the backend and save it the first time, the device called the backend. Use this UUID for logging the device activity.

    3. On every request to the backend, send the device UUID and check it.

    4. Make sure, that you have a way in the backend to stop the activity of a device and user.

    5. In some of my apps, I use the device UUID for individual encryption.

    6. If you want, you can encrypt your whole app by using this plugin:

    http://plugreg.com/plugin/EddyVerbruggen/SSLCertificateChecker-PhoneGap-Plugin

    1. In some of my apps (B2B apps), I use an authorization which is working via QR code. In the backend I create some individual «secure Infos» and show them as an QR code. In the app you have a barcodescanner which scans the info , which is then saved on the device. Works great and this is a good way to have individual keys on the devices.
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效