如何从站点检索令牌,并在POST方法中使用它 [英] How to retrieve a token from a site, and use it in a POST method
问题描述
您好,我正在尝试这样做:
我想从以下网址获取名为X-CSRF-TOKEN的令牌: http://www.roblox.com/home使用Roblox.XsrfToken.setToken('')我猜我需要解析网站才能得到它,我试过了
Hello, here is what I am trying to do:
I want to get a token called "X-CSRF-TOKEN" from the following URL: "http://www.roblox.com/home" using Roblox.XsrfToken.setToken('') I am guessing I would need to parse the website to get it, I tried
var token = Roblox.XsrfToken.setToken('')
token.href = "http://www.roblox.com/My/GroupAdmin.aspx"
我不确定我是否采用正确的方式,但是一次我有一个令牌,我需要张贴到http://www.roblox.com/groups/api/change-member-rank
I am not sure if I am going the right way with that, however once I have the token I need to make a POST to "http://www.roblox.com/groups/api/change-member-rank"
$.ajax({
type: "POST",
url: "http://www.roblox.com/groups/api/change-member-rank"
data: {
X-CSRF-TOKEN: [The token]
X-Requested-With: XMLHttpRequest
}
});
?
带有变量groupId,newRoleSetId和targetUserId的
并传递X-CSRF- TOKEN从我们刚刚得到的内容,以及X-Requested-With:XMLHttpRequest到我上面提到的url /My/GroupAdmin.aspx。我想我还需要传递一个cookie吗?
我在这里要做的是创建一个自动系统,以团队或部落的形式宣传本网站的用户,我知道这是可能的,因为我已经看到多个其他人这样做,但他们似乎并不想告诉我该怎么做,我给你的信息就是我一直在弄清楚自己。
当我以合法方式进行POST时,这是返回的信息:
?
with the variables groupId, newRoleSetId, and targetUserId and pass the "X-CSRF-TOKEN" from what we just got above, along with "X-Requested-With: XMLHttpRequest" to the url /My/GroupAdmin.aspx I put above. I think I also need to pass a cookie with this?
What I am trying to do here is create an automated system that promotes users of this website in a group or clan, and I know this is possible as I have seen multiple others do it, however they did not seem to want to tell me how to do it, and the information I gave you is what I have been figuring out myself.
When I make the POST the legitimate way, this is the information that is returned:
POST /groups/api/change-member-rank?groupId=1190045&newRoleSetId=7835958&targetUserId=563473 HTTP/1.1
Host: www.roblox.com
Connection: keep-alive
Content-Length: 0
Accept: */*
Origin: http://www.roblox.com
X-CSRF-TOKEN: pJLkcw7TXHlV
X-Requested-With: XMLHttpRequest
如果您有任何疑问,请询问。
If you have anymore questions, please ask.
推荐答案
.ajax({
type: POST,
url: http://www.roblox.com/groups/api/change-member-rank
数据:{
X-CSRF-TOKEN:[令牌]
X-Requested-With:XMLHttpRequest
}
});
.ajax({ type: "POST", url: "http://www.roblox.com/groups/api/change-member-rank" data: { X-CSRF-TOKEN: [The token] X-Requested-With: XMLHttpRequest } });
?
带有变量groupId,newRoleSetId和targetUserId的
并从我们上面的内容传递X-CSRF-TOKEN,以及X-Requested-With:XMLHttpRequest到我上面提到的url /My/GroupAdmin.aspx。我想我还需要传递一个cookie吗?
我在这里要做的是创建一个自动系统,以团队或部落的形式宣传本网站的用户,我知道这是可能的,因为我已经看到多个其他人这样做,但他们似乎并不想告诉我该怎么做,我给你的信息就是我一直在弄清楚自己。
当我以合法方式进行POST时,这是返回的信息:
?
with the variables groupId, newRoleSetId, and targetUserId and pass the "X-CSRF-TOKEN" from what we just got above, along with "X-Requested-With: XMLHttpRequest" to the url /My/GroupAdmin.aspx I put above. I think I also need to pass a cookie with this?
What I am trying to do here is create an automated system that promotes users of this website in a group or clan, and I know this is possible as I have seen multiple others do it, however they did not seem to want to tell me how to do it, and the information I gave you is what I have been figuring out myself.
When I make the POST the legitimate way, this is the information that is returned:
POST /groups/api/change-member-rank?groupId=1190045&newRoleSetId=7835958&targetUserId=563473 HTTP/1.1
Host: www.roblox.com
Connection: keep-alive
Content-Length: 0
Accept: */*
Origin: http://www.roblox.com
X-CSRF-TOKEN: pJLkcw7TXHlV
X-Requested-With: XMLHttpRequest
如果您有任何疑问,请询问。
If you have anymore questions, please ask.
这篇关于如何从站点检索令牌,并在POST方法中使用它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!