dounai9294 2015-02-17 17:28
浏览 62
已采纳

too long

I'm making an app on android that allows the user, after having gotten the name and password, modify your profile through a web api rest.

i have established a system to return, once authenticated, a unique security token which will be used to authenticate the user to perform operations (update the profile).

I used an URL like this for the first time which the user have access (login):

webserver.com/?login&user=michael&password=7c4a8d09ca3762af61e59520943dc26494f8941b

Then, if the data are correct, the rest api return an unique token to the android app. The android app store this unique token for make, until the user doesn't close session, the updates of his profile.

I used for updates an URL like this:

webserver.com/?update&token=ee977806d7286510da8b9a7492ba58e2484c0ecc&newname=mathews

Then, when the user close the session (inside the android app), I remove the token from the web server throught another url...

Is this a good system? It's my token "safe"?

I store those url (without the value of parameters) in constants of my android app... It's safe? I can do otherwise?

  • 写回答

2条回答 默认 最新

  • dongwu9972 2015-02-18 19:00
    关注

    No, this is not safe. Never stuff credentials in the URL as URLs tends to be logged in many different places, leaving the credentials exposed to third party. Use the HTTP body for that sort of thing.

    Always use encrypted SSL/TLS to transfer credentials. Or use a crypto system like OAuth1 to avoid sending credentials in clear text. OAuth1 defines a scheme for proving ownership of credentials without actually sending them.

    Use the HTTP Authorization header for tokens. Search for "http authorization bearer token".

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
  • ¥15 opencv图像处理,需要四个处理结果图
  • ¥15 无线移动边缘计算系统中的系统模型
  • ¥15 深度学习中的画图问题
  • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条
  • ¥15 Python报错怎么解决
  • ¥15 simulink如何调用DLL文件
  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
  • ¥30 线性代数的问题,我真的忘了线代的知识了