@invizi/cli 0.1.13 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/auth.js +2 -60
  2. package/package.json +1 -1
package/dist/auth.js CHANGED
@@ -107,66 +107,8 @@ export async function getAuthorizationHeader() {
107
107
  return null;
108
108
  }
109
109
  async function login() {
110
- const { domain, audience, clientId } = getAuth0Config();
111
- const deviceRes = await fetch(`https://${domain}/oauth/device/code`, {
112
- method: 'POST',
113
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
114
- body: new URLSearchParams({
115
- client_id: clientId,
116
- audience,
117
- scope: DEFAULT_SCOPE,
118
- }),
119
- });
120
- if (!deviceRes.ok) {
121
- const body = await deviceRes.text();
122
- throw new Error(`Auth0 device flow init failed: ${body}`);
123
- }
124
- const device = await deviceRes.json();
125
- console.log('\nAuth0 login required');
126
- console.log(`1) Open: ${device.verification_uri_complete || device.verification_uri}`);
127
- if (!device.verification_uri_complete) {
128
- console.log(`2) Enter code: ${device.user_code}`);
129
- }
130
- const deadline = Date.now() + (device.expires_in * 1000);
131
- let intervalMs = (device.interval || 5) * 1000;
132
- while (Date.now() < deadline) {
133
- await sleep(intervalMs);
134
- const tokenRes = await fetch(`https://${domain}/oauth/token`, {
135
- method: 'POST',
136
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
137
- body: new URLSearchParams({
138
- grant_type: 'urn:ietf:params:oauth:grant-type:device_code',
139
- device_code: device.device_code,
140
- client_id: clientId,
141
- }),
142
- });
143
- const token = await tokenRes.json();
144
- if (tokenRes.ok && token.access_token && token.expires_in) {
145
- setStoredAuth({
146
- accessToken: token.access_token,
147
- refreshToken: token.refresh_token,
148
- expiresAt: Date.now() + (token.expires_in * 1000),
149
- tokenType: token.token_type,
150
- scope: token.scope,
151
- domain,
152
- audience,
153
- clientId,
154
- });
155
- console.log('\nLogin successful.');
156
- return 0;
157
- }
158
- if (token.error === 'authorization_pending')
159
- continue;
160
- if (token.error === 'slow_down') {
161
- intervalMs += 5000;
162
- continue;
163
- }
164
- if (token.error === 'expired_token') {
165
- throw new Error('Device code expired. Run `invizi auth login` again.');
166
- }
167
- throw new Error(`Login failed: ${token.error || 'unknown error'}`);
168
- }
169
- throw new Error('Login timed out before authorization completed.');
110
+ console.log('Login is not available yet. Coming soon!');
111
+ return 1;
170
112
  }
171
113
  async function status() {
172
114
  const header = await getAuthorizationHeader();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@invizi/cli",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "Invizi CLI",
5
5
  "type": "module",
6
6
  "bin": {