duande8497
2015-07-17 06:22 阅读 68

身份验证,仅限html和Javascript

I have done this for browser but now I am developing a hybrid app. I need authentication, I can only use html and JavaScript, since Hybrid app does not support php code. How do I do it such that when app starts it checks, if user is logged on (either via sending a status check request to server, or suggest any other way possible, if php code was possible to use i would check for some session variables and redirect based on that). If user is logged on send inside the app or else present login form. I cannot use Facebook, Google login etc in this case.

Thanks.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • dqtdz08206 dqtdz08206 2015-07-17 06:26

    PHP is serverside, you could not have used it "for browser" except on the web server. You would use it for your hybrid app in exactly the same way - on the web server, and not inside your hybrid app. In your hybrid app, you would have an AJAX call, for example, contacting your server for authentication and persistence. It does not need to be PHP, but it does need to be a serverside executable.

    You need the server primarily because it makes no sense to even ask if the user is logged in unless there is somewhere they can be logged into

    点赞 评论 复制链接分享

相关推荐