-
Notifications
You must be signed in to change notification settings - Fork 0
docs(api): clarify OAuth discovery location and client_credentials behavior #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -20,17 +20,16 @@ OAuth tokens authenticate **users** against the Dashboard API on `app.photon.cod | |||||
| | Revocation | `POST https://app.photon.codes/api/auth/oauth2/revoke` | | ||||||
| | Introspection | `POST https://app.photon.codes/api/auth/oauth2/introspect` | | ||||||
| | JWKS | `GET https://app.photon.codes/api/auth/jwks` | | ||||||
| | Discovery | `GET https://app.photon.codes/.well-known/oauth-authorization-server/api/auth` — see [Discovery](#discovery) | | ||||||
|
|
||||||
| ### Discovery | ||||||
|
|
||||||
| Because the issuer contains a path component (`/api/auth`), the metadata documents live at the [RFC 8414 §3.1](https://datatracker.ietf.org/doc/html/rfc8414#section-3.1) path-insertion URLs — the issuer's path goes *after* the well-known segment: | ||||||
| The discovery document — the JSON metadata listing every endpoint, scope, and capability of the provider — is served at: | ||||||
|
|
||||||
| ``` | ||||||
| https://app.photon.codes/.well-known/oauth-authorization-server/api/auth | ||||||
| https://app.photon.codes/.well-known/openid-configuration/api/auth | ||||||
| ``` | ||||||
| - OAuth 2.1 metadata: [`https://app.photon.codes/.well-known/oauth-authorization-server/api/auth`](https://app.photon.codes/.well-known/oauth-authorization-server/api/auth) | ||||||
| - OpenID Connect metadata: [`https://app.photon.codes/.well-known/openid-configuration/api/auth`](https://app.photon.codes/.well-known/openid-configuration/api/auth) | ||||||
|
|
||||||
| Libraries that derive the metadata URL from the issuer per RFC 8414 resolve these automatically. Some OIDC clients instead append `/.well-known/openid-configuration` to the issuer or probe the domain root — both of those 404 here, so configure the discovery URL (or the individual endpoints) explicitly in that case. | ||||||
| The trailing `/api/auth` looks unusual, but it's where a spec-compliant client will look: the issuer contains a path component, and [RFC 8414 §3.1](https://datatracker.ietf.org/doc/html/rfc8414#section-3.1) inserts the issuer's path *after* the well-known segment, not before. Libraries that derive the metadata URL from the issuer per RFC 8414 resolve this automatically. Two common variants don't work here and 404: appending `/.well-known/openid-configuration` to the issuer, and probing the domain root's `/.well-known/` directly. If your library does either, configure the discovery URL (or the individual endpoints) explicitly. | ||||||
|
Comment on lines
+29
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
for url in \
'https://app.photon.codes/.well-known/oauth-authorization-server/api/auth' \
'https://app.photon.codes/.well-known/openid-configuration/api/auth' \
'https://app.photon.codes/api/auth/.well-known/openid-configuration'
do
printf '%s -> ' "$url"
curl --silent --show-error --location \
--output /dev/null \
--write-out '%{http_code}\n' \
"$url"
doneRepository: photon-hq/docs Length of output: 380 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- oauth.mdx relevant sections ---'
sed -n '1,45p' api-reference/oauth.mdx
printf '%s\n' '--- introduction authentication section ---'
sed -n '25,42p' api-reference/introduction.mdx
printf '%s\n' '--- live metadata bodies ---'
for url in \
'https://app.photon.codes/.well-known/oauth-authorization-server/api/auth' \
'https://app.photon.codes/.well-known/openid-configuration/api/auth'
do
printf '\n%s\n' "$url"
curl --silent --show-error --location --fail "$url"
printf '\n'
doneRepository: photon-hq/docs Length of output: 8166 Document the OpenID Connect URL as provider-specific. RFC 8414 supports the OAuth metadata URL, but OpenID Connect Discovery derives 🤖 Prompt for AI AgentsSource: MCP tools |
||||||
|
|
||||||
| ## Create an OAuth app | ||||||
|
|
||||||
|
|
@@ -174,6 +173,6 @@ Users can also withdraw an app's access at any time from their dashboard setting | |||||
|
|
||||||
| ## Limitations | ||||||
|
|
||||||
| - **No machine-to-machine tokens.** The `client_credentials` grant is not supported — every access token represents a user who went through the consent flow. For server-to-server project automation, use the Spectrum API's [project credentials](/api-reference/introduction#authentication) instead. | ||||||
| - **No dynamic client registration.** The discovery document advertises a `registration_endpoint`, but programmatic registration is disabled — create apps in the [dashboard](https://app.photon.codes/dashboard/developer/apps). | ||||||
| - **No machine-to-machine tokens.** The token endpoint will issue a token for the `client_credentials` grant, but don't be fooled: that token identifies your app, not a user, and no Dashboard API endpoint accepts app-only tokens — every call returns `401`. Only tokens from the authorization code flow work, so there is nothing a `client_credentials` token can currently be used for. For server-to-server project automation, use the Spectrum API's [project credentials](/api-reference/introduction#authentication) instead. | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Replace the authorization-code-only claim.
Proposed wording-Only tokens from the authorization code flow work, so there is nothing a `client_credentials` token can currently be used for.
+Only user-associated tokens work. This includes tokens from the CLI device flow and the authorization code flow. A `client_credentials` token currently has no usable Dashboard API purpose.📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| - **No dynamic client registration.** The [discovery document](#discovery) advertises a `registration_endpoint`, but programmatic registration is disabled — create apps in the [dashboard](https://app.photon.codes/dashboard/developer/apps). | ||||||
| - **`S256` only.** The `plain` PKCE challenge method is rejected, and PKCE cannot be skipped. | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: photon-hq/docs
Length of output: 14946
🌐 Web query:
RFC 8414 scopes_supported optional metadata authorization server metadata issuer path resolution OpenID Connect Discovery💡 Result:
In RFC 8414 (OAuth 2.0 Authorization Server Metadata), the scopes_supported metadata parameter is classified as RECOMMENDED [1][2]. Because it is not marked as REQUIRED, it is effectively optional for an authorization server to include it in its metadata document [1][2]. If included, it contains a JSON array listing the OAuth 2.0 scope values supported by the server; however, servers are permitted to omit some supported scope values from this list even when the parameter is present [1][2]. Regarding issuer path resolution, RFC 8414 differs from the OpenID Connect Discovery 1.0 specification [3][4]. Under RFC 8414, if an issuer identifier contains a path component, the well-known URI suffix (e.g., oauth-authorization-server) is inserted between the host component and the path component [3]. For example, for an issuer of https://example.com/issuer1, the metadata is retrieved from: https://example.com/.well-known/oauth-authorization-server/issuer1 [3][4] In contrast, OpenID Connect Discovery 1.0 appends the well-known URI suffix (e.g., openid-configuration) to the end of the issuer identifier [3][5]. For the same issuer of https://example.com/issuer1, the metadata is retrieved from: https://example.com/issuer1/.well-known/openid-configuration [3][5][4]
Citations:
🏁 Script executed:
Repository: photon-hq/docs
Length of output: 564
🌐 Web query:
OpenID Connect Discovery 1.0 issuer path .well-known/openid-configuration exact URL construction💡 Result:
According to the OpenID Connect Discovery 1.0 specification, the discovery URL for an OpenID Provider is constructed by concatenating the string /.well-known/openid-configuration to the Issuer URL [1][2][3]. The specific process for constructing this URL is as follows: 1. Identification: Start with the Issuer URL [1][3]. 2. Path Normalization: If the Issuer URL contains a path component, any terminating forward slash (/) must be removed before appending the discovery path [1][2][3]. 3. Concatenation: Append /.well-known/openid-configuration to the resulting string [1][2][3]. Examples: - If the Issuer is https://example.com (no path), the resulting discovery URL is https://example.com/.well-known/openid-configuration [1][3]. - If the Issuer is https://example.com/issuer1 (with a path), the resulting discovery URL is https://example.com/issuer1/.well-known/openid-configuration [1][3]. This mechanism allows OpenID Providers to support multiple issuers on a single host, which is a requirement for many multi-tenant hosting configurations [3][4]. While RFC 5785 (which defines the.well-known concept) typically reserves well-known URIs for the root of the path hierarchy, OpenID Connect Discovery 1.0 specifically extends this behavior to support path-based isolation by appending the configuration suffix to the Issuer identifier [3][5].
Citations:
🏁 Script executed:
Repository: photon-hq/docs
Length of output: 863
Correct the discovery metadata description and OpenID Connect URL.
scopes_supportedto list every supported scope. Replace “listing every endpoint, scope, and capability” with “describes its OAuth configuration, including endpoints, supported scopes, and capabilities.”/.well-known/openid-configurationto the issuer path. Usehttps://app.photon.codes/api/auth/.well-known/openid-configuration, not the RFC 8414-style path.🤖 Prompt for AI Agents
Sources: Coding guidelines, MCP tools