@assinafy/cli 2.1.1 → 2.1.2
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.
- package/README.en.md +2 -0
- package/README.md +2 -0
- package/dist/api.cjs +5 -1
- package/dist/api.cjs.map +1 -1
- package/dist/api.js +5 -1
- package/dist/api.js.map +1 -1
- package/dist/cli.cjs +84 -11
- package/dist/types/api/resources/oauth.d.ts.map +1 -1
- package/docs/oauth-guide.md +4 -0
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -124,6 +124,8 @@ assinafy workspaces list --json
|
|
|
124
124
|
|
|
125
125
|
The command opens the system browser and waits for consent. The HTTPS return page forwards the authorization response to a temporary listener on `127.0.0.1`. The CLI validates state and issuer, closes the listener, and exchanges the code using its local PKCE verifier. Use a browser on the same computer as the CLI. Tokens travel directly between the CLI and Assinafy.
|
|
126
126
|
|
|
127
|
+
Return pages use the visual identity hosted at `integrations.assinafy.com.br` and distinguish a received response, failed authorization, and an invalid return. Check the final result in your terminal. If it reports `invalid_scope`, verify the application's registered permissions, including `offline_access`.
|
|
128
|
+
|
|
127
129
|
Use `--no-browser` to open the URL printed to stderr manually while keeping automatic callback reception. `--timeout` sets the browser wait from 1 to 600 seconds (default 180), `--scope` selects permissions, and `--redirect-uri` selects another registered HTTPS page implementing the relay protocol. Ctrl+C cancels the wait. Token JSON goes to stdout; protect it from logs. `connect` does not modify a profile or automatically refresh tokens.
|
|
128
130
|
|
|
129
131
|
Select the single workspace returned and set `ASSINAFY_ACCOUNT_ID`. Keep refreshes serialized per connection and store each rotated result atomically. The existing `oauth authorize` and `oauth exchange` commands also support applications with their own callbacks and confidential server credentials. The [OAuth guide](./docs/oauth-guide.md#cli-flow) documents both flows, complete payloads, token rotation, identity validation, and disconnect behavior.
|
package/README.md
CHANGED
|
@@ -108,6 +108,8 @@ assinafy workspaces list --json
|
|
|
108
108
|
|
|
109
109
|
A CLI abre o navegador e aguarda o consentimento. A página HTTPS encaminha a resposta para uma porta temporária em `127.0.0.1`; a CLI valida `state` e o emissor, fecha a porta e troca o código usando o verificador PKCE mantido localmente. Não é necessário copiar um código. Use o navegador no mesmo computador da CLI. O site recebe a resposta de autorização; a troca de tokens ocorre diretamente entre a CLI e a Assinafy.
|
|
110
110
|
|
|
111
|
+
As telas de retorno usam a identidade visual de `integrations.assinafy.com.br` e distinguem resposta recebida, autorização não concluída e retorno inválido. Confira o resultado final no terminal. Se aparecer `invalid_scope`, verifique as permissões cadastradas para a aplicação, incluindo `offline_access`.
|
|
112
|
+
|
|
111
113
|
`--no-browser` permite abrir manualmente a URL exibida no stderr e mantém o retorno automático. `--timeout` controla a espera pelo navegador (180 segundos por padrão, de 1 a 600); `--scope` seleciona as permissões e `--redirect-uri` permite uma página HTTPS com o mesmo protocolo. Ctrl+C cancela a espera. A saída JSON contém tokens sensíveis; não a envie para logs. O comando não altera o perfil nem renova tokens automaticamente.
|
|
112
114
|
|
|
113
115
|
Selecione o único workspace retornado e configure `ASSINAFY_ACCOUNT_ID`. Tokens OAuth não autorizam cobrança, criação/exclusão de workspaces nem administração de credenciais. Cada refresh consome o token anterior: serialize a operação por conexão e salve o novo par de tokens atomicamente.
|
package/dist/api.cjs
CHANGED
|
@@ -1291,7 +1291,11 @@ var OAuthResource = class extends BaseResource {
|
|
|
1291
1291
|
throw new ValidationError("OAuth issuer mismatch");
|
|
1292
1292
|
}
|
|
1293
1293
|
if (callback.searchParams.has("error")) {
|
|
1294
|
-
|
|
1294
|
+
const error = callback.searchParams.get("error");
|
|
1295
|
+
const oauthError = error.length > 0 && error.length <= 64 && !/[^a-z_]/.test(error) ? error : "unknown_error";
|
|
1296
|
+
throw new ValidationError(`OAuth authorization was declined or failed: ${oauthError}`, {
|
|
1297
|
+
oauthError
|
|
1298
|
+
});
|
|
1295
1299
|
}
|
|
1296
1300
|
return this.token({
|
|
1297
1301
|
grant_type: "authorization_code",
|