|
| 1 | +# Guide - Authentication |
| 2 | + |
| 3 | +### Twitter |
| 4 | +1. Sign-in or sign-up for a Twitter account |
| 5 | +2. Go to the Twitter Application management page [here](https://apps.twitter.com/) |
| 6 | +3. Click on the **Create New App** button to create a new Twitter app: |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | +4. Fill out the create application form, check the developer agreement box, and click **Create Your Twitter Application** |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +*Note: you may have to register your phone number with Twitter to create a Twitter application* |
| 15 | + |
| 16 | +To do this Click your profile icon --> Settings and privacy --> Mobile --> Select Country/region --> Enter phone number --> Click Continue |
| 17 | + |
| 18 | +5. After you receive confirmation that the Twitter application was created, click **Keys and Access Tokens** |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | +6. Obtain your Twitter Consumer Key and Consumer Secret |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | +7. Add your Consumer Key and Consumer Secret to your config.json file or pass them as environment variables: |
| 27 | + * config.json: |
| 28 | + ````javascript |
| 29 | + { |
| 30 | + "production": { |
| 31 | + "twitter": { |
| 32 | + "consumerKey": "esTCJFXXXXXXXXXXXXXXXXXXX", |
| 33 | + "consumerSecret": "zpCs4tU86pRVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" |
| 34 | + } |
| 35 | + } |
| 36 | + } |
| 37 | + ```` |
| 38 | + * environment variables: |
| 39 | + ```` |
| 40 | + HMD_TWITTER_CONSUMERKEY=esTCJFXXXXXXXXXXXXXXXXXXX |
| 41 | + HMD_TWITTER_CONSUMERSECRET=zpCs4tU86pRVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
| 42 | + ```` |
| 43 | + |
| 44 | +### GitHub |
| 45 | +1. Sign-in or sign-up for a GitHub account |
| 46 | +2. Navigate to developer settings in your GitHub account [here](https://github.com/settings/developers) and select the "OAuth Apps" tab |
| 47 | +3. Click on the **New OAuth App** button, to create a new OAuth App: |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | +4. Fill out the new OAuth application registration form, and click **Register Application** |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | +*Note: The callback URL is <your-hackmd-url>/auth/github/callback* |
| 56 | + |
| 57 | +5. After successfully registering the application, you'll receive the Client ID and Client Secret for the application |
| 58 | +
|
| 59 | + |
| 60 | +
|
| 61 | +6. Add the Client ID and Client Secret to your config.json file or pass them as environment variables |
| 62 | + * config.json: |
| 63 | + ````javascript |
| 64 | + { |
| 65 | + "production": { |
| 66 | + "github": { |
| 67 | + "clientID": "3747d30eaccXXXXXXXXX", |
| 68 | + "clientSecret": "2a8e682948eee0c580XXXXXXXXXXXXXXXXXXXXXX" |
| 69 | + } |
| 70 | + } |
| 71 | + } |
| 72 | + ```` |
| 73 | + * environment variables: |
| 74 | + ```` |
| 75 | + HMD_GITHUB_CLIENTID=3747d30eaccXXXXXXXXX |
| 76 | + HMD_GITHUB_CLIENTSECRET=2a8e682948eee0c580XXXXXXXXXXXXXXXXXXXXXX |
| 77 | + ```` |
0 commit comments