简体   繁体   中英

Django Authenticate

Having for instance http://mywebsite.com?increase_counter=true/

I want to let someone increase counter on my database with a GET request but only when he is authenticated. How can someone be authenticated when coding in something external? eg shell or API.

Should I consider using tokens in GET request or is there an easy way to firstly authenticate someone with a simple request POST or GET and then execute url? EG I want to authenticate myself to django app with a simple shell. How to do it? Maybe another way?

I think your easiest approach is to include some sort of authentication tokens with the GET itself. The problem is that in order for you to be able to use other forms of authentication, you'll need to actually package the data (HTTP Authentication requires an authentication header, traditional authentication requires a cookie header).

If all you want to do is create a simple point-of-entry, then GET parameters are no more complicated than concatenating some strings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM