File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed
adminforth/documentation/docs/tutorial/05-Plugins Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -299,6 +299,44 @@ plugins: [
299
299
]
300
300
```
301
301
302
+ ### Twitch Adapter
303
+
304
+ Install Adapter:
305
+
306
+ ```
307
+ npm install @adminforth/twitch-oauth-adapter --save
308
+ ```
309
+
310
+ 1 . Go to the [ Twitch dashboard] ( https://dev.twitch.tv/console/ )
311
+ 2 . Create a new app or select an existing one
312
+ 3 . In ` OAuth Redirect URLs ` add ` https://your-domain/oauth/callback ` (` http://localhost:3500/oauth/callback ` )
313
+ 4 . Go to the app and copy ` Client ID ` , click to ` Generate a new client secret ` (in Twitch this button can be used only once for some time, becouse of this dont lose it) button and copy secret .
314
+ 5 . Add the credentials to your ` .env ` file:
315
+
316
+ ``` bash
317
+ TWITCH_OAUTH_CLIENT_ID=your_twitch_client_id
318
+ TWITCH_OAUTH_CLIENT_SECRET=your_twitch_client_secret
319
+ ```
320
+
321
+ Add the adapter to your plugin configuration:
322
+
323
+ ``` typescript title="./resources/adminuser.ts"
324
+ import AdminForthAdapterTwitchOauth2 from ' @adminforth/twitch-oauth-adapter' ;
325
+
326
+ // ... existing resource configuration ...
327
+ plugins : [
328
+ new OAuthPlugin ({
329
+ adapters: [
330
+ ...
331
+ new AdminForthAdapterTwitchOauth2 ({
332
+ clientID: process .env .TWITCH_OAUTH_CLIENT_ID ,
333
+ clientSecret: process .env .TWITCH_OAUTH_CLIENT_SECRET ,
334
+ }),
335
+ ],
336
+ }),
337
+ ]
338
+ ```
339
+
302
340
### Need custom provider?
303
341
304
342
Just fork any existing adapter e.g. [ Google] ( https://github.com/devforth/adminforth-google-oauth-adapter ) and adjust it to your needs.
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import AdminForthAdapterGithubOauth2 from "../../adapters/adminforth-github-oau
18
18
import AdminForthAdapterFacebookOauth2 from "../../adapters/adminforth-facebook-oauth-adapter" ;
19
19
import AdminForthAdapterKeycloakOauth2 from "../../adapters/adminforth-keycloak-oauth-adapter" ;
20
20
import AdminForthAdapterMicrosoftOauth2 from "../../adapters/adminforth-microsoft-oauth-adapter" ;
21
+ import AdminForthAdapterTwitchOauth2 from "../../adapters/adminforth-twitch-oauth-adapter" ;
21
22
import { randomUUID } from "crypto" ;
22
23
23
24
declare global {
@@ -38,6 +39,8 @@ declare global {
38
39
KEYCLOAK_REALM : string ;
39
40
MICROSOFT_CLIENT_ID : string ;
40
41
MICROSOFT_CLIENT_SECRET : string ;
42
+ TWITCH_CLIENT_ID : string ;
43
+ TWITCH_CLIENT_SECRET : string ;
41
44
42
45
}
43
46
}
@@ -133,6 +136,10 @@ export default {
133
136
clientSecret : process . env . MICROSOFT_CLIENT_SECRET ,
134
137
useOpenID : true ,
135
138
} ) ,
139
+ new AdminForthAdapterTwitchOauth2 ( {
140
+ clientID : process . env . TWITCH_CLIENT_ID ,
141
+ clientSecret : process . env . TWITCH_CLIENT_SECRET ,
142
+ } ) ,
136
143
// new AdminForthAdapterKeycloakOauth2({
137
144
// name: "Keycloak",
138
145
// clientID: process.env.KEYCLOAK_CLIENT_ID,
You can’t perform that action at this time.
0 commit comments