Protecting API URL Data from being seen. cURL?

陌路散爱 提交于 2019-12-25 07:14:40

问题


How can we password protect our Deployd data accessed via URL?
Currently our users' data is visible on oursite.com/users. How can we make it password protected so that only we,the site developers, can see our users' data via oursite.com/users? (This is my first API and Deployd app.) Many, many thanks!

I found the following, if any of these look like they would work: https://www.npmjs.com/package/dpd-curl-proxy https://www.npmjs.com/package/passport-oauth


回答1:


  1. Try in your 'get' event

    if (!me)

    cancel('You donot have access');

This will restrict 'users' -resource from accessed without login.

  1. To restrict access to certain user group - Use roles. That will look like,

    if (!me && !me.Admin) cancel('You donot have access');

You can try MARS CMS https://github.com/moorthi07/MarsCMS as boilerplate to rapid learning or prototype. This covers lots of Deployd's features like authentication , authorization, REST calls, ngResource examples.



来源:https://stackoverflow.com/questions/38234149/protecting-api-url-data-from-being-seen-curl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!