Passing values from HTML to python using EVE rest framework -


i creating website using html frontend , python backend using eve framework. have enabled token authentication usersrestful account management. when pass values eve framework gives me 401.

var login = function (logindata) {     var deferred = $q.defer();     $http.post(appconfig.serviceurl + 'user',{data:logindata}) 

here logindata holds username , password of user html page piece of code inside .js file.

my api.py holds following authentication code.

class rolesauth(tokenauth): def check_auth(self, token,  allowed_roles, resource, method):     # use eve's own db driver; no additional connections/resources used     accounts = app.data.driver.db['user']     lookup = {'token': token}     if allowed_roles:         lookup['roles'] = {'$in': allowed_roles}     account = accounts.find_one(lookup)     return account  def add_token(documents): # don't use in production: # should @ least make sure token unique. document in documents:     document["token"] = (''.join(random.choice(string.ascii_uppercase)                                   x in range(10))) 

my problem api.py run asks provide proper credentials. how can send token directly auth mechanism lets me access db.

how suggest me rid of authentication alert box.

i want token automatically sent api.

if suppose use basic authentication how can send username , password values directly , validate it? without having browser pop-up box asking username , password

thanks in advance.

does work curl ? refer this question

also, refer this , this thread on mailing list.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -