Cors

39 views
Skip to first unread message

Cemal

unread,
Nov 13, 2019, 7:53:29 AM11/13/19
to DroidScript
I send any page login request and give me cookies for next requests but me don't use
```
send("user=me;pass=123", "?login")
.then(res=>{ // {success: true}
if( res.success ) {
send(...).then(...) // -> {result: false, msg: pleas first login}
}
});

function send(data, to="") {
const opt = {
method: "POST",
credentials: "same-origin",
body: data,
headers: {
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
}
};
const res = await fetch(`http://example.com/${to}`, opt);
return await.json();
}
```

Symbroson

unread,
Nov 18, 2019, 3:22:09 PM11/18/19
to DroidScript
Depends on the website you want to log in to. Some don't support login via request
Reply all
Reply to author
Forward
0 new messages