Skip to content

Commit 3e3a577

Browse files
committed
Updated token docs for dcf
1 parent de5ddfa commit 3e3a577

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

docs/token.md

+31
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,36 @@ Expires At: 2023-08-23 22:06:47.036137 +0000 UTC
8989
Scopes: [moderator:manage:shield_mode moderator:manage:shoutouts]
9090
```
9191

92+
## Device Code Flow
93+
94+
If you wish to use Device Code Flow, the `--dcf` flag can be used alongside the `--user-token` flag.
95+
96+
Run the command as you would for a regular User Access Token, but include the `--dcf` flag:
97+
98+
```
99+
twitch token -u -s "moderator:manage:shoutouts moderator:manage:shield_mode" --dcf
100+
```
101+
102+
The terminal will then output information about how to authenticate in your web browser:
103+
104+
```
105+
Started Device Code Flow login.
106+
Use this URL to log in: https://www.twitch.tv/activate?device-code=SZPPRMFW
107+
Use this code when prompted at the above URL: SZPPRMFW
108+
109+
This system will check every 5 seconds, and will expire after 30 minutes.
110+
```
111+
112+
The application will then check Twitch's servers every 5 seconds to see if you have authenticated in your web browser. When it detects you have authenticated, it will output the tokens as expected:
113+
114+
```
115+
2024/03/12 11:42:24 Successfully generated User Access Token.
116+
2024/03/12 11:42:24 User Access Token: c012345asdfetc...
117+
2024/03/12 11:42:24 Refresh Token: 012345asdfetc...
118+
2024/03/12 11:42:24 Expires At: 2024-03-12 22:30:46.696108405 +0000 UTC
119+
2024/03/12 11:42:24 Scopes: [moderator:manage:shield_mode moderator:manage:shoutouts]
120+
```
121+
92122
## Revoking Access Tokens
93123

94124
Access tokens can be revoked with:
@@ -165,6 +195,7 @@ None.
165195
| Flag | Shorthand | Description | Example | Required? (Y/N) |
166196
|-------------------|-----------|------------------------------------------------------------------------------------------------------------------|-----------------------------------------------|-----------------|
167197
| `--user-token` | `-u` | Whether to fetch a user token or not. Default is false. | `token -u` | N |
198+
| `--dcf` | | Uses Device Code Flow for your User Access Token. Can only be used with --user-token | `token -u --dcf` | N |
168199
| `--scopes` | `-s` | The space separated scopes to use when getting a user token. | `-s "user:read:email user_read"` | N |
169200
| `--revoke` | `-r` | Instead of generating a new token, revoke the one passed to this parameter. | `-r 0123456789abcdefghijABCDEFGHIJ` | N |
170201
| `--validate` | `-v` | Instead of generating a new token, validate the one passed to this parameter. | `-v 0123456789abcdefghijABCDEFGHIJ` | N |

0 commit comments

Comments
 (0)