Skip to content

Documents the new sasjs auth login command - #30

Merged
allanbowe merged 2 commits into
masterfrom
feat/auth-login-docs
Aug 18, 2026
Merged

Documents the new sasjs auth login command#30
allanbowe merged 2 commits into
masterfrom
feat/auth-login-docs

Conversation

@allanbowe

Copy link
Copy Markdown
Member

Summary

Documents the new sasjs auth login command (see sasjs/cli PR from branch feat/password-grant-auth), which lets users authenticate against SAS Viya with a regular SAS username/password — no registered OAuth client/secret required.

Changes

docs/auth.md

  • The intro now describes the two modes of sasjs auth: bare sasjs auth (alias for sasjs add cred, unchanged) and the new sasjs auth login subcommand.
  • The SAS Viya Authentication section now presents both options: sasjs auth login (recommended for developers) and the client/secret flow (recommended for CI pipelines). The outdated claim that "SASjs does not support password authentication grant type" is removed.
  • New sasjs auth login section covering:
    • Syntax and example (sasjs auth login -t viyaLogged in as <id> (<name>)sasjs run)
    • Security properties: password is never stored; it is exchanged directly for a token pair persisted via the usual mechanism (.env.[target] / ~/.sasjsrc)
    • A warning admonition that ROPC is deprecated in OAuth 2.1 and the flow is intended for dev/demo estates
    • Token expiry & automatic refresh behaviour, including the short-TTL sas.cli quirk and rotating single-use refresh tokens (persisted automatically, incl. during long-running jobs)
    • Requirements & limitations: password grant must be enabled for sas.cli (default on Viya 3.5+/4); local/LDAP accounts only (no SSO/SAML/MFA); self-signed certificate guidance; cold-start compute session delays; 403 on unauthorised compute contexts (suggest SAS Studio compute context)

docs/faq.md

  • "How Does Authentication / Token Management work with SAS Viya?" — the "does not support the username / password approach" statement updated to scope it to the client/secret flow and point at sasjs auth login.
  • "How can I obtain a Viya client and secret?" — added a tip suggesting sasjs auth login first when the user just needs to run code as themselves.

Notes

  • Prettier reports pre-existing formatting warnings on both files (also on master); left untouched to keep the diff minimal.
  • Merge after the CLI feature PR lands so the docs don't describe unreleased behaviour.

…ient/secret)

- auth.md: new 'sasjs auth login' section covering syntax, the sas.cli
  password grant, token persistence, automatic refresh, and
  requirements/limitations (SSO-only estates, short TTLs, cold starts,
  compute context 403s); the Viya section now presents both flows
- faq.md: the 'no password grant' statement updated; client/secret FAQ
  now points at sasjs auth login as a simpler alternative

@4gl-reviewer 4gl-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hermes Agent Code Review

Verdict: Approve

Documentation-only PR describing the new sasjs auth login (password-grant against the public sas.cli client) flow. The content is accurate, well-structured, and the internal links resolve.

Warnings

  • None blocking.

Suggestions

  • docs/auth.md: the intro says sasjs auth login is "Viya only" and the dedicated section restates "SAS Viya target" — good. One nit: the "All authenticated commands" list on the new line includes sasjs context, which is not in the top-of-page list (line 11–18) of commands that use auth. Either add sasjs context to the top list for consistency, or drop it from the auth login paragraph so the two lists agree.
  • Pre-existing: line 64 still has ACESS_TOKEN (missing C). Not introduced by this PR, but it's in a paragraph you edited — a cheap fix while you're here.
  • Per the PR notes, this should merge after the CLI feature PR lands, to avoid documenting unreleased behaviour. Worth confirming the CLI PR is merged/released before publishing.

Looks Good

  • The ROPC / OAuth 2.1 deprecation admonition is clearly flagged and scoped to dev/demo use, with CI pointed to the client/secret flow — correct security framing.
  • Requirements & limitations section is thorough: password-grant enablement, local/LDAP-only (no SSO/SAML/MFA), self-signed cert pointer to httpsAgentOptions, cold-start compute delay, 403 → contextName: "SAS Studio compute context" hint.
  • Token-refresh note correctly calls out the short-TTL sas.cli quirk and single-use rotating refresh tokens being persisted during long-running jobs.
  • The #tls-config anchor target exists (line 153 ## TLS Config), and the #sasjs-auth-login anchors resolve.

Reviewed by Hermes Agent (GitHub App)

Comment thread docs/faq.md
For the client / secret flow (`sasjs auth`), the CLI will only work with pairs that have the 'authorization_code' grant type.

Alternatively, `sasjs auth login` authenticates with a SAS username and password (no client/secret required) using the password grant against the built-in `sas.cli` public client. See [sasjs auth](/auth/#sasjs-auth-login).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: the link text is See [sasjs auth](/auth/#sasjs-auth-login) but the anchor #sasjs-auth-login points at the sasjs auth login section, not sasjs auth. Suggest See [sasjs auth login](/auth/#sasjs-auth-login) so the text matches the destination.

- auth.md: document the --insecure/-i flag on sasjs auth login
  (self-signed estates), pointing to httpsAgentOptions as the fix
- add.md: tip that users without a client/secret can skip the Viya
  credential prompt and use sasjs auth login instead

@4gl-reviewer 4gl-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hermes Agent Code Review

Verdict: Approve — docs-only change accurately describes the new sasjs auth login flow implemented in sasjs/cli#1460. The --insecure flag description, the sas.cli password-grant details, the /identities/users/@currentUser verification step, and the token-rotation note all match the implementation. The cross-link from add.md and faq.md is helpful. One tiny pre-existing typo flagged inline; not a blocker.

✅ Looks Good

  • The warning that the password grant is deprecated in OAuth 2.1 and intended for dev/demo estates is the right framing.
  • Requirements/limitations section correctly notes SSO/SAML/MFA-only estates won't work.
  • Token-expiry note correctly documents the single-use rotating refresh-token behaviour and the CLI's automatic persistence.

Reviewed by Hermes Agent (GitHub App)

Comment thread docs/auth.md

After you provide the client / secret, you are given a link which you must click to obtain the authorisation code. Be sure to select any scopes (such as openid) if presented.

Once you provide the authorisation code, the ACESS_TOKEN and REFRESH_TOKEN are saved and used for further connection requests. If the ACCESS_TOKEN expires (by default after 12 hours) the REFRESH_TOKEN will be used automatically to update, until it also expires (by default after 30 days). At this point, you will need to run `sasjs auth` once again.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Suggestion (pre-existing): ACESS_TOKEN is missing a C — should be ACCESS_TOKEN. This line is unchanged by this PR but sits in the same section you're editing, so it's a cheap fix to fold in. Not a blocker.

@allanbowe
allanbowe merged commit 63bdc36 into master Aug 18, 2026
@allanbowe
allanbowe deleted the feat/auth-login-docs branch August 18, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant