How to test the twitter API locally?

前端 未结 7 1883
南笙
南笙 2021-02-05 09:34

I\'m trying to write a web application that would use Twitter via OAuth.

  1. I run my local server as \'localhost\', so I need the callback URL to be something like

7条回答
  •  天涯浪人
    2021-02-05 09:59

    There is also another solution (a workaround, rather) which requires you to edit your hosts file.

    Here is how you do it on a linux box:

    1. Open your /etc/hosts file as root. To do this, you can open a terminal and type something like sudo vi /etc/hosts.

    2. Pick a non-existent domain to use as your local address, and add it to your hosts file. For example, you will need to add something similar to the following at the end.

      127.0.0.1 localhost.cep # this domain name was accepted.
      

    So, that's pretty much it. Pointing your browser to localhost.cep will now take you to your local server. Hope that helped :)

提交回复
热议问题