Scrappy Twitter API is a Go-backend project that is secured by the Magic SDK for Go.
This Next.js app authenticates the user and generates the Decentralised ID Token (DIDT) required to make POST or DELETE requests with the Scrappy Twitter API.
- Magic SDK: Allows users to sign up or log in.
- SWR: Lets us get user info using a hook.
- @hapi/iron: Lets us encrypt the login cookie for more security.
- Sign up for an account on Magic.
- Create an app.
- Copy your app's Test Secret Key (you'll need it soon).
-
git clone https://github.com/seemcat/scrappy-twitter-api-client.git
-
cd scrappy-twitter-api-client
-
mv .env.local.example .env.local
-
Populate .env.local with the correct Test keys from your Magic app:
NEXT_PUBLIC_MAGIC_TEST_PUBLISHABLE_KEY=pk_test_XXXXX NEXT_PUBLIC_MAGIC_TEST_SECRET_KEY=sk_test_XXXXX NEXT_PUBLIC_HAPI_IRON_SECRET=this-is-a-secret-value-with-at-least-32-characters
Note: The
HAPI_IRON_SECRET
is needed by @hapi/iron to encrypt an object. Feel free to leave the default value as is in dev. -
yarn
-
yarn dev
-
Generate your DID token and keep this open (you'll need it soon).
- Follow the steps listed here to spin up your own local Go server and to set up the Scrappy Twitter API Postman Collection.
- You'll be passing the DID token you just generated as a Bearer token into the Postman Collection’s HTTP Authorization request header. (Don't forget to click save!)
- Send your requests to the DEV Scrappy Twitter API! 🎉