Twitter Authentification w/ RAW Labs Twitter library

If you check the RAW Labs public library you will find a Twitter library

In the code you will see things like the following :

read_json[users_response](  "https://api.twitter.com/2/users",
                                http_args:=[
                                            ("ids", ids),
                                            ("expansions", expansions),
                                            ("tweet.fields", `tweet.fields`),
                                            ("user.fields", `user.fields`)
                                        ],
                                http_client_id := client_id,
                                http_client_secret := client_secret,
                                http_token_url := "https://api.twitter.com/oauth2/token",
                                http_renew_token_use_basic_auth := true
                            )

In order to get this to work you need to get the client_id and client_secret right from twitter.com

You need to head to https://developer.twitter.com/en/portal/dashboard and create a project and an App.

I my case I created the app “RAW-Labs” under Project1

If you click on the settings you can then chose the “Keys & token” tab on the next screen.

There, you need to generate (or regenerate) the keys.
Hitting this button will create the API Key and the API Key secret which are respectively the client_id and the client_id_secret in the code snippet above.

A good practice is not to copy/paste this into your code but rather use secrets to store them and to retrieve them programmatically.