Scrappy Twitter API is a Go-backend project that is secured by the Magic SDK for Go.
This Go server is where all of the Scrappy Twitter API requests are handled. Once the user has generated a Decentralised ID Token (DIDT) from the client side, they can pass it into their Request Header as a Bearer token to hit protected endpoints.
- POST a tweet (protected): http:https://localhost:8080/tweet
- GET all tweets (unprotected): http:https://localhost:8080/tweets
- GET a single tweet (unprotected): http:https://localhost:8080/tweet/1
- DELETE a tweet (protected): http:https://localhost:8080/tweet/2
- gorilla/handlers: Lets us enable CORS.
- gorilla/mux: Lets us build a powerful HTTP router and URL matcher.
- magic-admin-go/client: Lets us instantiate the Magic SDK for Go.
- magic-admin-go/token: Lets us create a Token instance.
- Sign up for an account on Magic.
- Create an app.
- Copy your app's Live Secret Key (you'll need it soon).
git clone https://github.com/seemcat/scrappy-twitter-api-server.git
cd scrappy-twitter-api-server
mv .env.example .env
- Paste the Live Secret Key you just copied as the value for
MAGIC_SECRET_KEY
in .env:MAGIC_SECRET_KEY=sk_XXXXXXXXXX
- Run all .go files with
go run .
-
Import the DEV version of the Scrappy Twitter API Postman Collection:
-
Generate a DID token on the Client side.
Click here to spin up your own local client and generate the DID token there.
-
Pass the DID token as a Bearer token into the Postman Collection’s HTTP Authorization request header and click save.
-
Send your requests to the Scrappy Twitter API! 🎉