You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cmd/token.go
+11-5
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,7 @@ var validateToken string
21
21
varoverrideClientIdstring
22
22
vartokenServerPortint
23
23
vartokenServerIPstring
24
+
varredirectHoststring
24
25
25
26
// loginCmd represents the login command
26
27
varloginCmd=&cobra.Command{
@@ -37,20 +38,25 @@ func init() {
37
38
loginCmd.Flags().StringVarP(&revokeToken, "revoke", "r", "", "Instead of generating a new token, revoke the one passed to this parameter.")
38
39
loginCmd.Flags().StringVarP(&validateToken, "validate", "v", "", "Instead of generating a new token, validate the one passed to this parameter.")
39
40
loginCmd.Flags().StringVar(&overrideClientId, "client-id", "", "Override/manually set client ID for token actions. By default client ID from CLI config will be used.")
40
-
loginCmd.Flags().StringVar(&tokenServerIP, "ip", "localhost", "Manually set the IP address to be binded to for the User Token web server.")
41
+
loginCmd.Flags().StringVar(&tokenServerIP, "ip", "", "Manually set the IP address to be bound to for the User Token web server.")
41
42
loginCmd.Flags().IntVarP(&tokenServerPort, "port", "p", 3000, "Manually set the port to be used for the User Token web server.")
43
+
loginCmd.Flags().StringVar(&redirectHost, "redirect-host", "localhost", "Manually set the host to be used for the redirect URL")
Copy file name to clipboardExpand all lines: docs/token.md
+30-8
Original file line number
Diff line number
Diff line change
@@ -97,6 +97,14 @@ Access tokens can be revoked with:
97
97
twitch token -r 0123456789abcdefghijABCDEFGHIJ
98
98
```
99
99
100
+
## Alternate IP for User Token Webserver
101
+
102
+
If you'd like to bind the webserver used for user tokens (`-u` flag), you can override it with the `--ip` flag. For example:
103
+
104
+
```
105
+
twitch token -u --ip 127.0.0.1"
106
+
```
107
+
100
108
## Alternate Port
101
109
102
110
Port 3000 on localhost is used by default when fetching User Access Tokens. The `-p` flag can be used to change to another port if another service is already occupying that port. For example:
NOTE: You must update the first entry in the _OAuth Redirect URLs_ section of your app's management page in the [Developer's Application Console](https://dev.twitch.tv/console/apps) to match the new port number. Make sure there is no `/` at the end of the URL (e.g. use `http://localhost:3030` and not `http://localhost:3030/`) and that the URL is the first entry in the list if there is more than one.
109
117
110
118
119
+
## Alternate Host
120
+
121
+
If you'd like to change the hostname for one reason or another (e.g. binding to a local domain), you can use the `--redirect-host` to change the domain. You should _not_ prefix it with `http` or `https`.
122
+
123
+
Example:
124
+
125
+
```
126
+
twitch token -u --redirect-host contoso.com
127
+
```
128
+
129
+
NOTE: You must update the first entry in the _OAuth Redirect URLs_ section of your app's management page in the [Developer's Application Console](https://dev.twitch.tv/console/apps) to match the new port number. Make sure there is no `/` at the end of the URL (e.g. use `http://localhost:3030` and not `http://localhost:3030/`) and that the URL is the first entry in the list if there is more than one.
130
+
131
+
111
132
## Errors
112
133
113
134
This error occurs when there's a problem with the OAuth Redirect URLs. Check in the app's management page in the [Developer's Application Console](https://dev.twitch.tv/console/apps) to ensure the first entry is set to `http://localhost:3000`. Specifically, verify that your using `http` and not `https` and that the URL does not end with a `/`. (If you've changed ports with the `-p` flag, ensure those numbers match as well)
@@ -126,14 +147,15 @@ None.
126
147
127
148
**Flags**
128
149
129
-
| Flag | Shorthand | Description | Example | Required? (Y/N) |
|`--user-token`|`-u`| Whether to fetch a user token or not. Default is false. |`token -u`| N |
132
-
|`--scopes`|`-s`| The space separated scopes to use when getting a user token. |`-s "user:read:email user_read"`| N |
133
-
|`--revoke`|`-r`| Instead of generating a new token, revoke the one passed to this parameter. |`-r 0123456789abcdefghijABCDEFGHIJ`| N |
134
-
|`--port`|`-p`| Override/manually set the port for token actions. (The default is 3000) |`-p 3030`| N |
135
-
|`--client-id`|| Override/manually set client ID for token actions. By default client ID from CLI config will be used. |`--client-id uo6dggojyb8d6soh92zknwmi5ej1q2`| N |
136
-
150
+
| Flag | Shorthand | Description | Example | Required? (Y/N) |
|`--user-token`|`-u`| Whether to fetch a user token or not. Default is false. |`token -u`| N |
153
+
|`--scopes`|`-s`| The space separated scopes to use when getting a user token. |`-s "user:read:email user_read"`| N |
154
+
|`--revoke`|`-r`| Instead of generating a new token, revoke the one passed to this parameter. |`-r 0123456789abcdefghijABCDEFGHIJ`| N |
155
+
|`--ip`|| Manually set the port to be used for the User Token web server. The default binds to all interfaces. (0.0.0.0) |`--ip 127.0.0.1`| N |
156
+
|`--port`|`-p`| Override/manually set the port for token actions. (The default is 3000) |`-p 3030`| N |
157
+
|`--client-id`|| Override/manually set client ID for token actions. By default client ID from CLI config will be used. |`--client-id uo6dggojyb8d6soh92zknwmi5ej1q2`| N |
158
+
|`--redirect-host`|| Override/manually set the redirect host token actions. The default is `localhost`|`--redirect-host contoso.com`| N |
0 commit comments