Skip to content

Commit 4d0c18c

Browse files
committed
Add CLI docs
Signed-off-by: dusan <[email protected]>
1 parent 55f228f commit 4d0c18c

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

cli/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,48 @@ supermq-cli users create <user_name> <user_email> <user_password> <user_token>
3434
supermq-cli users token <user_email> <user_password>
3535
```
3636

37+
#### OAuth Authentication
38+
39+
Authenticate using OAuth providers (e.g., Google) to obtain access tokens. This command opens your browser for authentication and returns access and refresh tokens.
40+
41+
```bash
42+
supermq-cli users oauth <provider>
43+
```
44+
45+
Example with Google:
46+
47+
```bash
48+
supermq-cli users oauth google
49+
```
50+
51+
**How it works:**
52+
53+
1. The CLI starts a local HTTP server on `localhost:9090` to receive the OAuth callback
54+
2. Opens your default browser to the OAuth provider's authorization page
55+
3. After you authenticate with the provider, you'll be redirected back to the CLI
56+
4. The CLI exchanges the authorization code for access and refresh tokens
57+
5. Tokens are displayed in JSON format
58+
59+
**Output:**
60+
61+
```json
62+
{
63+
"access_token": "eyJhbGc...",
64+
"refresh_token": "eyJhbGc..."
65+
}
66+
```
67+
68+
**Prerequisites:**
69+
70+
The OAuth provider must be configured on the SuperMQ server. For Google OAuth, the following environment variables must be set:
71+
72+
- `SMQ_GOOGLE_CLIENT_ID` - Google OAuth client ID
73+
- `SMQ_GOOGLE_CLIENT_SECRET` - Google OAuth client secret
74+
- `SMQ_GOOGLE_REDIRECT_URL` - OAuth redirect URL (e.g., `http://localhost:9002/oauth/callback/google`)
75+
- `SMQ_GOOGLE_STATE` - OAuth state parameter for security
76+
77+
See the [Users Service README](../users/README.md#oauth-configuration) for more details.
78+
3779
#### Get User
3880

3981
```bash

0 commit comments

Comments
 (0)