[英]how to convert the instagram curl post request to javascript request?
I'm trying to change the code i got from Instagram to a token.我正在尝试将我从 Instagram 获得的代码更改为令牌。 In Instagram DOCS it is writes with a curl request and i want to use JavaScript.在 Instagram DOCS 中,它使用 curl 请求写入,我想使用 JavaScript。 its look like this:它看起来像这样:
curl -X POST \
https://api.instagram.com/oauth/access_token \
-F client_id={app-id} \
-F client_secret={app-secret} \
-F grant_type=authorization_code \
-F redirect_uri={redirect-uri} \
-F code={code}
I'm trying to understand what is -F
and with what symbol to replace it.我试图了解什么是-F
以及用什么符号来替换它。
Any solution will help, thank you.任何解决方案都会有所帮助,谢谢。
-F is for emulating html form submission https://curl.se/docs/manpage.html#-F -F 用于模拟 html 表单提交https://curl.se/docs/manpage.html#-F
if you want to sent the request using JavaScript fetch() API, set all those parameters as body of request and set the content type to application/x-www-form-urlencoded如果您想使用 JavaScript fetch() API 发送请求,请将所有这些参数设置为请求正文并将内容类型设置为application/x-www-form-urlencoded
if you are sending these requests interactively, alternatively you can create an HTML page with a form and submit button.( eg https://www.w3schools.com/tags/att_form_enctype.asp )如果您以交互方式发送这些请求,或者您可以创建一个带有表单和提交按钮的 HTML 页面。(例如https://www.w3schools.com/tags/att_form_enctype.asp )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.