Skip to content

Commit 978ec84

Browse files
authored
Merge pull request #601 from devonJS/auth-docs
Added small guide for auth providers GitHub and Twitter
2 parents d8997f9 + 8c916bb commit 978ec84

10 files changed

+85
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ There are some configs you need to change in the files below
235235
| service | settings location | description |
236236
| ------- | --------- | ----------- |
237237
| facebook, twitter, github, gitlab, mattermost, dropbox, google, ldap | environment variables or `config.json` | for signin |
238-
| imgur | environment variables or `config.json` | for image upload |
238+
| imgur, s3 | environment variables or `config.json` | for image upload |
239239
| google drive(`google/apiKey`, `google/clientID`), dropbox(`dropbox/appKey`) | `config.json` | for export and import |
240240

241241
## Third-party integration oauth callback urls

config.json.example

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@
7777
},
7878
"imgur": {
7979
"clientID": "change this"
80-
}
80+
},
81+
"s3": {
82+
"accessKeyId": "change this",
83+
"secretAccessKey": "change this",
84+
"region": "change this"
85+
},
86+
"s3bucket": "change this"
8187
}
8288
}

docs/guides/auth.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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+
![create-twitter-app](images/auth/create-twitter-app.png)
9+
10+
4. Fill out the create application form, check the developer agreement box, and click **Create Your Twitter Application**
11+
12+
![register-twitter-application](images/auth/register-twitter-application.png)
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+
![twitter-app-confirmation](images/auth/twitter-app-confirmation.png)
21+
22+
6. Obtain your Twitter Consumer Key and Consumer Secret
23+
24+
![twitter-app-keys](images/auth/twitter-app-keys.png)
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+
![create-oauth-app](images/auth/create-oauth-app.png)
50+
51+
4. Fill out the new OAuth application registration form, and click **Register Application**
52+
53+
![register-oauth-application-form](images/auth/register-oauth-application-form.png)
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+
![application-page](images/auth/application-page.png)
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+
````
120 KB
Loading
27.3 KB
Loading
113 KB
Loading
60 KB
Loading
198 KB
Loading
187 KB
Loading
159 KB
Loading

0 commit comments

Comments
 (0)