dongshimao7115 2012-01-19 23:09
浏览 52

Codeigniter通过移动设备访问REST api

Am almost done with an app am building with codeigniter, and i want to create a REST api which will allow the mobile version of the site and maybe in the future native mobile apps communicate with the database via a REST api.
Am using Phil Sturgeon REST Controller library, for now am able to create api keys for my users which are stored on the db.The API is primarily for creating a backend, and is to have closed access for certain parts the main for the main.
My question is:
Is possible to authenticate users with api and still use the api keys

  • 写回答

1条回答 默认 最新

  • duanmei2805 2012-01-20 19:03
    关注

    If you're creating a separate API Key for each user, then you can just add in some logic in your API controllers to authenticate and give them access to certain methods.

    Otherwise, you can create some API methods that would authenticate the user - pass back a "request token" and then use that for subsequent requests. Then you would give access to certain methods based on that request token.

    The gist is that you need some identifying information. If it is an API Key, then that works. If not, you'll need to create that identifying information. (for this example, that would be the "request token".

    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么