@lunch-money/developer-docs 2.11.2-preview.4 → 2.11.2-preview.5

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.
@@ -1,8 +1,8 @@
1
1
  # Implement the authorization-code flow
2
2
 
3
- After you [register an OAuth client](/oauth/register-client), your application uses its settings—including its client ID, client secret, if configured, and a registered redirect URI—to implement the authorization flow. As shown in the [OAuth overview](/oauth), your application sends the user to Lunch Money, Lunch Money returns an authorization code to your callback, and your application exchanges that code for tokens. Step 4 explains how to identify the Lunch Money user and budgeting account associated with the resulting connection.
3
+ After you [register an OAuth client](/oauth/register-client), your application uses its settings—including its client ID, client secret, and registered redirect URI—to implement the authorization flow. As shown in the [OAuth overview](/oauth), your application sends the user to Lunch Money, Lunch Money returns an authorization code to your callback, and your application exchanges that code for tokens.
4
4
 
5
- This guide walks through that process for a **Confidential web client**. Your server handles the callback and token exchange and keeps the client secret and refresh tokens secure. If you are building a standalone mobile or desktop application, read the [native application guidance](/oauth/native-apps) instead. Expo developers can also follow the [native Expo sample](/oauth/sample-applications#native-expo-sample).
5
+ This guide walks through that process for a **Confidential web client**. Your server handles the callback and token exchange and keeps the client secret and refresh tokens secure. If you are building a standalone mobile or desktop application, read the [native application guidance](/oauth/native-apps) instead.
6
6
 
7
7
  ## Choose an OAuth library
8
8
 
@@ -15,7 +15,7 @@ OAuth libraries handle much of the protocol work for you, including generating P
15
15
 
16
16
  For Node.js and TypeScript, [`openid-client`](https://github.com/panva/openid-client) is one maintained option. Despite its name, using it does not mean that Lunch Money supports OpenID Connect identity scopes, ID tokens, or UserInfo.
17
17
 
18
- The [confidential Node.js sample application](/oauth/sample-applications#understand-the-confidential-teaching-code) shows this library in a complete Lunch Money flow. Begin with its [`src/oauth` guide](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/main/src/oauth/README.md), then follow the listed reading order from protocol types and discovery through authorization, callback validation, credential storage, API access, optional refresh, and revocation.
18
+ The [confidential Node.js sample application](/oauth/sample-applications#understand-and-apply-the-teaching-code) shows this library in a complete Lunch Money flow. Begin with its [`src/oauth` guide](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/main/src/oauth/README.md), then follow the listed reading order from protocol types and discovery through authorization, callback validation, credential storage, API access, optional refresh, and revocation.
19
19
 
20
20
  ## Configure Lunch Money with discovery
21
21
 
@@ -42,8 +42,6 @@ On your server, generate:
42
42
 
43
43
  Redirect the browser to the discovered authorization endpoint with `response_type=code`, your `client_id`, exact `redirect_uri`, `state`, `code_challenge`, and `code_challenge_method=S256`.
44
44
 
45
- Lunch Money handles sign-in, budgeting-account selection, and consent. A user may have multiple budgeting accounts, but this authorization is for the one they select. Keep the authorization attempt bound to the application user who started it.
46
-
47
45
  > [!NOTE] Scopes come from the client registration
48
46
  > You do not need to send `scope`. If your OAuth library includes it, Lunch Money ignores the requested value and uses the client's complete registered scope set. An authorization request cannot narrow or expand that set; changing scopes requires a replacement client.
49
47
 
@@ -77,16 +75,8 @@ Authorization: Bearer YOUR_ACCESS_TOKEN
77
75
 
78
76
  The operation must be allowed by the token's scope and by the user's access to the selected budgeting account. See the [scope catalog](/oauth/scopes).
79
77
 
80
- `GET /v2/me` requires `me:read`. Its `id` identifies the Lunch Money user, while `account_id` and `budget_name` identify the selected budgeting account. Associate these details with the application user's connection and display the connected budget. When reconnecting, use the new response to establish the account identity rather than assuming the user selected the same budget. See [users, budgeting accounts, and access tokens](/oauth/concepts#users-budgeting-accounts-and-access-tokens).
81
-
82
- Store the credential set under the authenticated application user's ID and the returned `account_id`. Treat that pair as the owner of the connection: update the same record when the user reauthorizes that budgeting account, and create or select a separate record when they authorize another account. Persist the access token, refresh token when present, scope, expiration metadata, and account identity together. Do not use `budget_name` as the key or try to derive the account identity by parsing the opaque access token.
83
-
84
- Retain the returned Lunch Money user `id` with the connection as well. Your application establishes ownership through its own authenticated session. When authorization starts, store the authenticated application user's internal ID in the server-side authorization attempt associated with `state`. After validating the callback and calling `GET /v2/me`, store the credentials with that application-user ID and the returned Lunch Money `id`/`account_id` pair.
85
-
86
- For later requests, look up the selected connection using both its connection ID and the authenticated application user's internal ID. If no matching record exists, reject the request before loading or decrypting credentials. When the same application user reauthorizes a budgeting account, replace credentials only in the record matching that application user and Lunch Money `id`/`account_id` pair. Values supplied by the browser, including a connection ID or `account_id`, select a candidate record but do not establish ownership. See [Associate credentials with your application user](/oauth/security#associate-credentials-with-your-application-user) for the storage and ownership rules.
87
-
88
78
  ## 5. Continue or recover
89
79
 
90
- Use the response's `expires_in` value to track the expected lifetime of the access token. You can refresh slightly before expiry as a proactive optimization, or wait for an API request to return `401` and refresh then. In either case, coordinate refreshes for each connection, retry the failed request at most once after a successful refresh, and reauthorize after a terminal refresh failure. Read [token lifecycle and recovery](/oauth/tokens) before implementing refresh, logout, or revocation.
80
+ Use the response's `expires_in` value to schedule renewal slightly before expiry. Read [token lifecycle and recovery](/oauth/tokens) before implementing refresh, logout, or revocation.
91
81
 
92
82
  Next: [Develop and test your OAuth application](/oauth/development).
@@ -10,42 +10,6 @@ These terms describe who participates in Lunch Money OAuth and what each credent
10
10
  - **Authorization server:** the Lunch Money-owned service that presents the Lunch Money sign-in and consent screens, records the user's decision, and issues authorization codes and tokens. It also handles token requests, including exchanging authorization codes and refresh tokens for new tokens. The user signs in directly with Lunch Money; the third-party application never receives or sees their Lunch Money login credentials.
11
11
  - **Lunch Money API service:** the Lunch Money-owned V2 API, which receives the application's API requests, accepts access tokens, and checks that each request is permitted by the client's scopes.
12
12
 
13
- ## Users, budgeting accounts, and access tokens
14
-
15
- A **Lunch Money user** is the person who signs in to Lunch Money. One user can have access to multiple **budgeting accounts**, such as a personal budget, a household budget, and a test budget. Each budgeting account contains its own financial data. Here, “budgeting account” means that collection of data, not an individual bank or manually managed account within it.
16
-
17
- During OAuth authorization, the user selects one budgeting account and approves your client's permissions. The resulting **OAuth access token is specific to that Lunch Money user and budgeting account pair**, for your client. It does not grant access to every budgeting account the user can access.
18
-
19
- For example, Alex can access both “Household” and “API testing.” If Alex selects “API testing” during authorization, your application's access token operates on that budgeting account. It cannot use the same token to read or update “Household.” Scopes determine which operations the application may perform within the selected account; they do not add access to other budgeting accounts.
20
-
21
- When applications store OAuth credentials, they should associate the authorization with the application user who started the flow and keep track of which Lunch Money user and budgeting account that connection represents.
22
-
23
- ### Identify the authorized user and account
24
-
25
- If your client has the `me:read` scope, call `GET /v2/me` with the access token. The response identifies both sides of the connection:
26
-
27
- | Field | Meaning |
28
- | --- | --- |
29
- | `id` | The Lunch Money user's ID |
30
- | `account_id` | The selected budgeting account's ID |
31
- | `budget_name` | The selected budgeting account's display name |
32
-
33
- Use the IDs to associate API data with the correct user and budgeting account, and show `budget_name` so the application user can see which budget they are using. Do not treat `id` alone as the budgeting-account identity or use `budget_name` as a unique identifier. Access tokens are opaque credentials; obtain this information from the API response rather than parsing the token.
34
-
35
- ### Select a different budgeting account
36
-
37
- Applications should provide a UI that allows users to switch between budgeting accounts they have already authorized through that application, or to authorize another budgeting account.
38
-
39
- To connect to a new, previously unauthorized, budgeting account, send the user through authorization again and have them select it. Changing a locally stored account ID does not change which account an existing token can access. Refreshing a token renews access for its existing authorization; it does not select another budgeting account.
40
-
41
- Authorizing a second budgeting account creates or reuses that budget's connection and does not revoke the first one. Update each connection's credentials and account identity together, and keep cached data from one account separate from data loaded for another.
42
-
43
- ### Reauthorize an existing budgeting account
44
-
45
- If the user selects a budgeting account that is already connected to your application, treat the authorization as a reconnection of that existing connection. Match it by the stable `account_id`, keep that connection's identity, and atomically replace its stored access-token and refresh-token set with the credentials from the successful exchange. Reauthorizing the same budgeting account reuses that account's grant family; it does not create a second connection or affect the user's other budgeting accounts.
46
-
47
- When the user chooses to switch between existing authorized budgets, select the saved connection for that `account_id` and use its stored access token to make API calls. The application UI should show which budgeting account is currently active.
48
-
49
13
  ## Client types and credentials
50
14
 
51
15
  When a developer registers a client, they must choose a client type based on whether the application code can keep a client secret secure. This choice cannot be changed after the client is registered. The developer selects either **Confidential web client** or **Native or public client**.
@@ -27,21 +27,19 @@ For a client in development, register an HTTP redirect using a supported loopbac
27
27
 
28
28
  You may choose any available port, but the complete redirect URI sent during authorization must match the registered value exactly. `localhost` and `127.0.0.1` are different hosts, so register the form your application sends. Non-loopback HTTP hosts, embedded credentials, and URI fragments are not supported.
29
29
 
30
- The user's browser—not Lunch Money's server—connects to the loopback listener. Keep PKCE and `state` protections in place just as you would for a hosted callback. Before requesting review, also register the HTTPS callback used by the deployed application; the loopback URI can remain available for local testing.
30
+ The user's browser—not Lunch Money's server—connects to the loopback listener. Keep PKCE and `state` protections in place just as you would for a hosted callback. Before requesting review, also register the HTTPS callback used by the deployed application; the loopback URI can remain available for local testing. After approval, you can add or keep a loopback redirect as long as that production HTTPS callback remains. See [after approval](/oauth/review-and-approval#after-approval).
31
31
 
32
32
  > [!NOTE] Test an approved client with your development team
33
- > After a client is approved, other team members can continue developing and testing the application's Lunch Money functionality. If the approved client has a loopback redirect registered, each developer who can run the application locally may authorize access to their own Lunch Money budgeting account. The client ID is public, but developers working on a confidential web client also need access to its client secret through your team's secure credential-management process. Do not share access tokens or refresh tokens between developers.
33
+ > After a client is approved, other team members can continue developing and testing the application's Lunch Money functionality. You can add or keep a loopback redirect on the approved client as long as the production HTTPS callback remains. If a loopback redirect is registered, each developer who can run the application locally may authorize access to their own Lunch Money budgeting account. The client ID is public, but developers working on a confidential web client also need access to its client secret through your team's secure credential-management process. Do not share access tokens or refresh tokens between developers.
34
34
 
35
35
  ## Repeat or reset authorization
36
36
 
37
- During development, the client owner can run authorization again whenever they want to repeat the sign-in, budgeting-account selection, consent, and callback flow. They do not need to revoke the current token first. Selecting the same budgeting account reuses that account's grant; selecting a different account creates or reuses a separate connection and leaves the first connection available.
37
+ During development, the client owner can run authorization again whenever they want to repeat the sign-in, budgeting-account selection, consent, and callback flow. They do not need to revoke the current token first; a new successful authorization replaces their previous active authorization for that client.
38
38
 
39
39
  To test how the application responds after access is revoked, revoke the current token and make another API request with it. Lunch Money should reject the request, and the application should discard its saved credentials and begin authorization again. The [token revocation guide](/oauth/tokens#revoke-access) includes copyable `curl` requests for development testing.
40
40
 
41
41
  ## Test the complete client
42
42
 
43
- If the client owner has multiple budgeting accounts, test authorization with a separate test account first, then repeat the flow and select a different account. For a client registered with `me:read`, confirm that `GET /v2/me` returns the same user `id` and the newly selected `account_id`. Store the credentials under the authenticated application user and that account ID, show the selected budget, and do not display cached data from another connection. Switch back to the first saved connection without authorizing again, then verify that revoking or invalidating one connection does not affect the other.
44
-
45
43
  1. Complete authorization. For each attempt, your application should create a random `state` value, save it with the application user's session, and verify that Lunch Money returns the same value to the callback. Rejecting a missing, changed, or reused value prevents a callback started elsewhere from being attached to the wrong session.
46
44
  2. Keep the PKCE verifier with that same authorization attempt and use it when exchanging the returned code. Confirm that an exchange with a missing or changed verifier fails; this prevents someone who intercepts the code from using it.
47
45
  3. Read the token response's `scope` field and confirm that it contains the complete scope set registered for the client. Do not inspect or parse the access token itself.
@@ -52,7 +50,7 @@ If the client owner has multiple budgeting accounts, test authorization with a s
52
50
 
53
51
  First make sure your application can recover without a refresh token. Record when the token response arrives and use `expires_in` to determine when the access token is expected to expire. After it expires, make a harmless API request and confirm that Lunch Money returns an authentication failure identifying the token as invalid.
54
52
 
55
- Your application should discard the unusable token for that connection and start authorization again. Confirm that the same application user can complete the flow, select the intended budgeting account, and continue using that connection with the replacement token. This recovery path is required when a client does not have `offline_access`, and it remains the fallback when a refresh token expires, is revoked, or otherwise stops working. Keep other connections usable while this one recovers.
53
+ Your application should discard the unusable token and start authorization again. Confirm that the same application user can complete the flow, select a budgeting account, and continue using the application with the replacement token. This recovery path is required when a client does not have `offline_access`, and it remains the fallback when a refresh token expires, is revoked, or otherwise stops working.
56
54
 
57
55
  After reauthorization works, clients registered with `offline_access` can add and test refresh-token handling. Verify replacement-token storage, concurrent-refresh protection, revocation, and terminal refresh recovery before relying on unattended operation. See [token lifecycle and recovery](/oauth/tokens).
58
56
 
@@ -21,8 +21,6 @@ Personal access tokens remain useful for quick work on your own account. OAuth i
21
21
 
22
22
  An OAuth client is an application's registration with Lunch Money. When a developer registers the client, they select the scopes—the specific permissions—the application needs. Later, when a Lunch Money user authorizes the application, Lunch Money shows them that complete permission set before they approve access. Choose only the permissions the application's features require. A focused permission request is easier for users to understand and trust, and reduces the risk of the application reading or changing data it does not need.
23
23
 
24
- One Lunch Money user can have multiple budgeting accounts and multiple connections to the same OAuth client. Each OAuth access token represents that user and the single budgeting account they selected during authorization. It does not provide access to all of their budgets. Read [users, budgeting accounts, and access tokens](/oauth/concepts#users-budgeting-accounts-and-access-tokens) for an example and how to identify the connected account.
25
-
26
24
  ## Before you start
27
25
 
28
26
  You need an active Lunch Money account to [register and manage an OAuth client](/oauth/applications) for your application. During development, only the client owner can authorize the application. Approval is required before other Lunch Money users can authorize it.
@@ -15,24 +15,12 @@ Use Lunch Money's authorization-server discovery document and configure `token_e
15
15
 
16
16
  Use a redirect mechanism that returns control to your app and that your platform can bind to it. Claimed Universal Links or Android App Links provide stronger app ownership than a custom URI scheme when correctly configured. A private-use scheme must contain a dot, such as `app.example.demo:/oauth/callback`, and must be protected against interception.
17
17
 
18
- Native clients may use an HTTP loopback redirect with `localhost`, `127.0.0.1`, or `[::1]`. The scheme, host, path, and query string must exactly match the registered URI, but the port may differ so the application can bind an ephemeral port at runtime. The exception applies only to loopback redirects for native clients; native HTTPS and private-use scheme redirects must match every component of the registered URI exactly.
18
+ Native clients may use an HTTP loopback redirect with `localhost`, `127.0.0.1`, or `[::1]`. The scheme, host, path, and query string must exactly match the registered URI, but the port may differ so the application can bind an ephemeral port at runtime. The exception applies only to loopback redirects for native clients; native HTTPS and private-use scheme redirects must match every component of the registered URI exactly. The loopback hosts are not interchangeable: a client registered with `http://127.0.0.1/cb` cannot authorize with `http://localhost:4000/cb` or `http://[::1]:4000/cb`, so register the host your app actually binds to.
19
19
 
20
20
  ## Store and renew tokens
21
21
 
22
22
  Store tokens in Keychain on Apple platforms. On Android, use current Keystore-backed storage guidance from your maintained library; do not start new work with deprecated `EncryptedSharedPreferences` APIs. Coordinate refresh-token use, persist replacements, and fall back to interactive authorization after terminal failure.
23
23
 
24
- ### Keep application users' connections separate
25
-
26
- A native app can support multiple application users on the same device. If your app has its own sign-in system, keep each user's saved Lunch Money connections in a separate storage namespace. Bind the authorization attempt to the application user who started it, and retain the Lunch Money `id` and `account_id` returned by `GET /v2/me` with each credential set. Only load a connection after verifying that it belongs to the currently authenticated application user. Secure device storage does not perform that application-level ownership check for you.
27
-
28
- On sign-out or user switching, stop work using the previous user's credentials and clear in-memory tokens, the active connection selection, and cached financial data. Remove saved credentials if your app does not retain connections across sign-ins; otherwise, make them available only after their owner signs in again. Do not attach an OAuth callback or refresh result from the previous session to the newly signed-in user.
29
-
30
- If your app has no separate user accounts, the device's OS account and app storage protections provide the local access boundary. Anyone allowed to use the unlocked app may be able to use its saved connections; separate budgeting-account records alone do not authenticate different people.
31
-
32
- Sending tokens to an application backend introduces server-side credential storage. If your architecture does that, apply the [credential ownership rules](/oauth/security#associate-credentials-with-your-application-user) on the backend as well as protecting credentials on the device.
33
-
34
- Platform code should delegate protocol validation to the maintained library while your application supplies safe configuration, lifecycle storage, API calls, revocation, and user-facing recovery.
35
-
36
- Lunch Money does not currently provide complete Swift or Kotlin samples; the upstream AppAuth projects provide maintained platform examples. Expo developers can use the [native Expo sample](/oauth/sample-applications#native-expo-sample) for a complete Lunch Money walkthrough and reference implementation.
24
+ Platform code should delegate protocol validation to the maintained library while your application supplies safe configuration, lifecycle storage, API calls, revocation, and user-facing recovery. Full Lunch Money Swift and Kotlin sample apps are not part of this documentation phase; the upstream AppAuth projects provide maintained platform examples.
37
25
 
38
26
  Next: [Review OAuth security guidance](/oauth/security).
@@ -11,7 +11,7 @@ Before you add OAuth to your application code, register an OAuth client with Lun
11
11
 
12
12
  List the Lunch Money features your application will provide, then use the [scope catalog](/oauth/scopes) to choose the smallest complete set of permissions those features require. Select `offline_access` only if the application needs to continue making API requests after the initial access token expires and while the user is away.
13
13
 
14
- If your application may support more than one budgeting account for the same application user, always include `me:read`. After authorization, `GET /v2/me` lets your application record the Lunch Money user's `id` and the selected budgeting account's `account_id`, then store each connection under the correct application user and account pair. The same scope is also required when your application only needs to identify the single budgeting account it has connected.
14
+ For the confidential Node.js sample, always select `me:read`. Add `offline_access` only if you want to exercise its optional refresh branch; the rest of the walkthrough does not require it.
15
15
 
16
16
  Scopes cannot be changed after registration. While you are developing your application, creating a replacement client is inexpensive, so let the scope set evolve as you learn what the application needs. Aim to have the application's core functionality—and its required permissions—settled before you submit the client for review.
17
17
 
@@ -32,6 +32,10 @@ A redirect URI tells Lunch Money where to return the user after authorization. R
32
32
 
33
33
  Web applications normally use an HTTPS callback. If you need a callback for local development, review the [loopback guidance](/oauth/development#local-loopback-callbacks) before registering one. Mobile and desktop applications may use a private-use scheme containing a dot, such as `app.example.demo:/oauth/callback`, or a verified HTTPS link accepted by the Developer Portal.
34
34
 
35
+ After the client is approved, you can add or replace redirect URIs in the Developer Portal without submitting another initial review. An approved confidential web client must keep a production HTTPS callback. See [after approval](/oauth/review-and-approval#after-approval).
36
+
37
+ Each client can have up to 10 redirect URIs, and each URI can be up to 2,048 characters. If you reach the limit, remove a callback the application no longer uses before adding another.
38
+
35
39
  ## Register the OAuth client
36
40
 
37
41
  Open the [new OAuth client form](/oauth/applications/new) in the Developer Portal. Then:
@@ -43,11 +47,13 @@ Open the [new OAuth client form](/oauth/applications/new) in the Developer Porta
43
47
  5. Select the planned scopes.
44
48
  6. Accept the current Lunch Money API Terms of Use and select **Register OAuth client**.
45
49
 
50
+ You can own up to 25 non-deleted OAuth clients. If you reach the limit, delete a client you no longer use before registering another.
51
+
46
52
  After registration, record the client ID in your application configuration. A client ID identifies the registration but is not a secret.
47
53
 
48
54
  If you registered a **Confidential web client**, create a client secret from its details page. Lunch Money shows the secret value only once. Copy it immediately into a secret manager or protected server configuration; it cannot be retrieved later. Never commit it or expose it in browser or mobile code.
49
55
 
50
- A confidential web client can have multiple active secrets. This allows you to introduce a replacement secret, update and verify the deployed application, and then revoke the old secret without interrupting authorization. See [OAuth security guidance](/oauth/security#operate-credentials-safely) when planning ongoing rotation.
56
+ A confidential web client can have up to three non-revoked secrets. This allows you to introduce a replacement secret, update and verify the deployed application, and then revoke the old secret without interrupting authorization. Expired secrets still count toward the limit until you revoke them. Revoking an obsolete secret frees a slot, and revoked secrets no longer appear in the client's secret list. See [OAuth security guidance](/oauth/security#operate-credentials-safely) when planning ongoing rotation.
51
57
 
52
58
  You now have the client settings needed to connect your application to Lunch Money.
53
59
 
@@ -10,7 +10,7 @@ When the application is ready, submit its client for review in the Developer Por
10
10
  | --- | --- | --- |
11
11
  | `development` | The client has not been submitted for review; only its owner can authorize it | Configure and test, then request review. |
12
12
  | `pending_review` | Review has been requested and is waiting for or receiving review; review-critical fields are frozen | Continue owner testing or cancel the request. |
13
- | `active` | The review was approved; other Lunch Money users may authorize the application | Operate within the approved identity and scope set. |
13
+ | `active` | The review was approved; other Lunch Money users may authorize the application | Keep configuration current; identity updates reach users after Lunch Money reviews them. |
14
14
  | `rejected` | Changes were requested | Read feedback, revise editable configuration, and resubmit. |
15
15
  | `disabled` | Lunch Money disabled the client; its owner is notified, authorization is unavailable, and existing grants no longer work | Review the reason provided and contact developer support when appropriate. |
16
16
 
@@ -52,6 +52,10 @@ Native clients may be reviewed with loopback or private-use scheme redirects.
52
52
 
53
53
  Submitting the request moves the client to `pending_review` and temporarily freezes review-critical fields. Reviews are usually completed within a couple of business days. You can continue developing and testing the application as the client owner while you wait. If you need to change a frozen field, cancel the request to return the client to `development`, make the change, and submit it again.
54
54
 
55
+ You can make up to five initial review submissions across all your clients in a rolling 24-hour period. Cancelled submissions and submissions made again after a rejection still count. Deleting a client does not remove its submissions from the window. Reviews opened automatically after you update the identity of an active client do not count toward this limit.
56
+
57
+ If you reach the limit, the Developer Portal tells you when you can submit again. Wait until that time before retrying; cancelling, deleting, or replacing a client does not reset the window.
58
+
55
59
  Lunch Money emails you when the review is complete. You can also check the current status and review history on the client's page in the Developer Portal.
56
60
 
57
61
  ## If review is denied
@@ -62,8 +66,12 @@ There is no review comment thread, so use the new request's additional context t
62
66
 
63
67
  ## After approval
64
68
 
65
- An `active` client can be authorized by other users. Reviewed identity fields, redirect configuration, and the registered scope set remain frozen after approval. Client-secret rotation and revocation remain available subject to lifecycle and security checks.
69
+ An `active` client can be authorized by other users. Keep its configuration current in the Developer Portal. You do not need to contact Lunch Money to rename the application, move hosting, or update a support address.
70
+
71
+ Changes save immediately, and the client stays `active`. Redirect URIs, support email, description, and developer name take effect as soon as you save them. An approved confidential web client must keep at least one public HTTPS redirect.
72
+
73
+ Name, logo, homepage URL, and privacy policy URL also save immediately, but Lunch Money users continue to see the last approved identity on the consent screen and Connected Apps page until Lunch Money reviews the update. The Developer Portal shows that as an identity update in review; it is not a return to `rejected`, and existing authorizations keep working.
66
74
 
67
- For an exceptional identity or configuration change, contact [developer support](mailto:developer-support@lunchmoney.app). A scope change always requires a replacement client and user reauthorization.
75
+ Client-secret rotation and revocation remain available subject to lifecycle and security checks. Scopes and client type cannot be changed after registration. A scope change requires a replacement client and user reauthorization.
68
76
 
69
77
  Next: [Review the security checklist](/oauth/security).
@@ -1,17 +1,13 @@
1
1
  # OAuth sample applications
2
2
 
3
- Use a sample application to see Lunch Money OAuth working end to end before you adapt the flow to your own architecture. Choose the confidential sample when a trusted server will hold credentials, or the native sample when an installed iOS or Android application will hold them. The two architectures have different security boundaries and are documented separately.
3
+ Use a sample application to see Lunch Money OAuth working end to end before you adapt the flow to your own architecture. Samples are separated by OAuth client type and platform because confidential and native clients have different credential boundaries.
4
4
 
5
- > [!TIP] Open-source samples
6
- > - [Confidential Node.js and TypeScript sample](https://github.com/lunch-money/lm-oauth-confidential-node-example) and its [README](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/main/README.md)
7
- > - [Native Expo sample for iOS and Android](https://github.com/lunch-money/lm-oauth-native-expo-example) and its [README](https://github.com/lunch-money/lm-oauth-native-expo-example/blob/main/README.md)
5
+ > [!TIP] Open-source sample
6
+ > [View the confidential Node.js sample on GitHub](https://github.com/lunch-money/lm-oauth-confidential-node-example) or begin with its [README](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/main/README.md).
8
7
 
9
8
  ## Confidential Node.js and TypeScript sample
10
9
 
11
- > [!NOTE] This walkthrough is for confidential applications
12
- > The walkthrough and teaching-code guide below apply to the confidential Node.js sample, where a trusted server holds the client secret and credentials. For an installed iOS or Android application that holds its own credentials without a client secret, skip to the [Native Expo sample](#native-expo-sample).
13
-
14
- [`lm-oauth-confidential-node-example`](https://github.com/lunch-money/lm-oauth-confidential-node-example) is a teaching sample for a **confidential, server-side web client**. It uses Node.js, TypeScript, and the maintained [`openid-client`](https://github.com/panva/openid-client) library to demonstrate:
10
+ `lm-oauth-confidential-node-example` is a teaching sample for a **confidential, server-side web client**. It uses Node.js, TypeScript, and the maintained [`openid-client`](https://github.com/panva/openid-client) library to demonstrate:
15
11
 
16
12
  - configuring a registered Lunch Money OAuth client and discovering authorization-server metadata;
17
13
  - starting authorization with single-use `state` and S256 Proof Key for Code Exchange (PKCE);
@@ -182,7 +178,7 @@ After the flow succeeds, connect each action you performed to the code that impl
182
178
  Before adapting the code, read the repository's [OAuth code guide](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/c8e4d8338d430a3247a48d6e017aaf68d84bd832/src/oauth/README.md), [security model](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/c8e4d8338d430a3247a48d6e017aaf68d84bd832/SECURITY.md), [production checklist](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/c8e4d8338d430a3247a48d6e017aaf68d84bd832/PRODUCTION_CHECKLIST.md), and [troubleshooting guide](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/c8e4d8338d430a3247a48d6e017aaf68d84bd832/TROUBLESHOOTING.md).
183
179
  <!-- END GENERATED OAUTH SAMPLE WALKTHROUGH -->
184
180
 
185
- ## Understand the confidential teaching code
181
+ ## Understand and apply the teaching code
186
182
 
187
183
  The open-source sample you just ran is designed to make the Lunch Money integration code easy to find, understand, and adapt. The modules under `src/oauth` show the OAuth responsibilities that a confidential server-side application needs: discovery, authorization attempts, callback validation, credential ownership and storage, API access, optional refresh, revocation, and safe error handling.
188
184
 
@@ -196,28 +192,8 @@ Start with the [`src/oauth` guide](https://github.com/lunch-money/lm-oauth-confi
196
192
 
197
193
  The OAuth teaching code is isolated under `src/oauth`. Hono, sessions, cookies, pages, and other runnable presentation code live under `src/scaffolding`, so you can replace the framework without obscuring the protocol flow. The sample's [architecture guide](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/main/ARCHITECTURE.md) explains this boundary, and its [OAuth tests](https://github.com/lunch-money/lm-oauth-confidential-node-example/tree/main/tests/oauth) mirror the recommended reading order, including focused [refresh tests](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/main/tests/oauth/refresh.test.ts). If your result differs, compare the stage that failed with the sample's [troubleshooting guide](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/main/TROUBLESHOOTING.md) and the public [OAuth troubleshooting guide](/oauth/troubleshooting).
198
194
 
199
- ## Native Expo sample
200
-
201
- Choose [`lm-oauth-native-expo-example`](https://github.com/lunch-money/lm-oauth-native-expo-example) for an iOS or Android application installed
202
- on the user's device when there is no trusted backend that can hold a client
203
- secret. It uses Expo, the platform authentication browser, authorization code
204
- with S256 PKCE, and platform secure storage as a native/public client. Its
205
- optional `offline_access` path demonstrates rotated refresh credentials and
206
- terminal reauthorization without introducing a backend or client secret.
207
-
208
- Do not choose it merely because your interface is responsive. Choose it because
209
- the installed application performs OAuth and owns its credential. If a trusted
210
- server performs the code exchange and stores credentials, use the confidential
211
- Node.js sample above instead.
212
-
213
- The native repository's [walkthrough](https://github.com/lunch-money/lm-oauth-native-expo-example/blob/main/docs/WALKTHROUGH.md) is the canonical hands-on guide;
214
- complete the registration, development-build, authorization, `/v2/me`,
215
- optional refresh, revocation, and local-reset walkthrough there.
216
-
217
- ### Follow the native flow through the source
218
-
219
- Start with the native sample's [`src/oauth` guide](https://github.com/lunch-money/lm-oauth-native-expo-example/blob/main/src/oauth/README.md). It provides the maintained reading order from public configuration and Expo's system-browser adapter through callback validation, secure credential storage, optional refresh, revocation, and the workflow connected to the sample screen.
195
+ ## Native applications
220
196
 
221
- The OAuth teaching code is isolated under `src/oauth`; React Native UI and platform storage adapters live under `src/scaffolding`. Use the sample's [OAuth tests](https://github.com/lunch-money/lm-oauth-native-expo-example/tree/main/tests) to follow the expected success and failure behavior, then review its [security guidance](https://github.com/lunch-money/lm-oauth-native-expo-example/blob/main/SECURITY.md) and [production checklist](https://github.com/lunch-money/lm-oauth-native-expo-example/blob/main/PRODUCTION_CHECKLIST.md) before adapting it.
197
+ A separate native/public-client sample is planned but is not yet available. Native mobile and desktop applications use PKCE **without a client secret** and store tokens in platform secure storage. Follow the [native application guidance](/oauth/native-apps); do not adapt the confidential sample by placing its client secret or server-held credentials in installed application code.
222
198
 
223
199
  Next: [Develop and test your OAuth application](/oauth/development) and [operate it securely](/oauth/security).
@@ -7,7 +7,7 @@ Choose the smallest complete set of permissions your application needs. This pag
7
7
 
8
8
  ## Scope groups
9
9
 
10
- Groups are selection shortcuts, not extra permissions. Every predefined group includes `me:read` so an application can identify the authorized Lunch Money user and budgeting account. A group expands to the exact scopes listed below.
10
+ Groups are selection shortcuts, not extra permissions. A group expands to the exact scopes listed below.
11
11
 
12
12
  ### Read only
13
13
 
@@ -26,25 +26,11 @@ If your browser code uses access tokens, keep them available for no longer than
26
26
 
27
27
  A confidential application must authenticate its own user before starting Lunch Money OAuth. Bind each authorization attempt to that authenticated user's server-side session, then recover the owner from the consumed server-side attempt after the callback is verified. Do not let the callback choose who owns the resulting credentials.
28
28
 
29
- Store each budgeting-account connection under a stable internal application-user ID. Retain the Lunch Money user `id` and budgeting-account `account_id` returned by `GET /v2/me` alongside that connection's credential set. The application-user ID identifies who may use the saved connection; the Lunch Money IDs identify whose authorization and which budgeting account the tokens represent. Do not use an email address, callback parameter, form field, or other browser-supplied value to establish the credential owner.
29
+ Store the verified credential set under a stable internal application-user ID. If one application user may connect more than one Lunch Money context, also assign each connection its own stable internal connection ID. These identifiers belong to your application; do not use an email address, callback parameter, form field, or any other browser-supplied value as the credential owner.
30
30
 
31
- ```text
32
- Authenticated application user
33
- -> owned connection (Lunch Money user id + account_id)
34
- -> encrypted credential set
35
- ```
31
+ Enforce the same ownership boundary every time your backend reads credentials, replaces them after authorization or refresh, revokes them, or deletes them. Durable credentials must be encrypted at rest, and backend access should be limited to the services and operators that need it. Never return refresh tokens or client secrets to browser JavaScript.
36
32
 
37
- When the user returns to your application, authenticate them through your application's own sign-in system before listing or using their saved connections. Knowing a Lunch Money `id`, `account_id`, or internal connection ID does not prove ownership. Limit connection lookups to the authenticated application user's records, and reject requests for a connection they do not own before loading its credentials.
38
-
39
- For example, if Alex and Sam both use your application, Sam must not be able to use Alex's saved credentials by submitting Alex's connection ID. This remains true even if they both have access to the same Lunch Money budgeting account. Each application user must authorize their own connection. If Alex has authorized two budgeting accounts, both connections belong to Alex's application user and may be listed and selected within Alex's authenticated session. Each connection still uses the credential set for its own Lunch Money `id`/`account_id` pair.
40
-
41
- Enforce this ownership check for every API request, refresh, reauthorization, revocation, and deletion involving a saved connection. Background jobs must carry the connection's stored owner and identity so they use the same checks without an interactive session. Updating credentials after reauthorization must remain within the original application user's connections and preserve the Lunch Money `id`/`account_id` identity. A different identity must not silently overwrite an existing connection.
42
-
43
- Durable credentials must be encrypted at rest, and backend access should be limited to the services and operators that need it. Encryption protects stored secrets; your application must still enforce ownership when it reads or uses them. Never return refresh tokens or client secrets to browser JavaScript. List connections using non-secret metadata such as `budget_name`, and keep their credentials in the protected store.
44
-
45
- Disconnecting one budgeting account should revoke continuing access for that connection and remove its locally stored credentials. Keep the user's other connections intact. On application sign-out or user switching, clear session-specific connection selections and cached data so the next user cannot use the previous user's connection. Signing out of your application and disconnecting Lunch Money are distinct actions; retained connections must remain accessible only through their owner's authenticated session or authorized background jobs.
46
-
47
- The [confidential Node.js sample](/oauth/sample-applications#understand-the-confidential-teaching-code) makes this boundary explicit in its [`CredentialStore`](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/main/src/oauth/tokens.ts) abstraction. Its [security guide](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/main/SECURITY.md) explains the threat model, and its [production checklist](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/main/PRODUCTION_CHECKLIST.md) lists the storage, tenant-isolation, lifecycle, and operational work the teaching sample deliberately omits. Those boundaries matter, but their implementation and database schema are specific to your application.
33
+ The [confidential Node.js sample](/oauth/sample-applications#understand-and-apply-the-teaching-code) makes this boundary explicit in its [`CredentialStore`](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/main/src/oauth/tokens.ts) abstraction. Its [security guide](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/main/SECURITY.md) explains the threat model, and its [production checklist](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/main/PRODUCTION_CHECKLIST.md) lists the storage, tenant-isolation, lifecycle, and operational work the teaching sample deliberately omits. Those boundaries matter, but their implementation and database schema are specific to your application.
48
34
 
49
35
  ## Secure authorization and callbacks
50
36
 
@@ -61,7 +47,7 @@ Choose only the resource scopes needed for expected features. Add `offline_acces
61
47
 
62
48
  ## Operate credentials safely
63
49
 
64
- Rotate client secrets on a schedule appropriate for your application's risk and immediately when one may have been exposed. Use overlapping active secrets during a controlled rotation: create the replacement, deploy and verify it, and then revoke the old secret. Coordinate refreshes so two workers do not replay the same rotating token, and atomically persist every complete replacement credential set. Production storage needs database transactions, distributed per-connection locking, recovery when persistence fails, multi-instance coordination, and tenant isolation. Make disconnect invalidate continuing refresh access as well as clear local state.
50
+ Rotate client secrets on a schedule appropriate for your application's risk and immediately when one may have been exposed. A client can have up to three non-revoked secrets, so confirm that it has room before starting a rotation. Expired secrets still count toward this limit until you revoke them. Use overlapping active secrets during a controlled rotation: create the replacement, deploy and verify it, and then revoke the old secret. Coordinate refreshes so two workers do not replay the same rotating token, and atomically persist every complete replacement credential set. Production storage needs database transactions, distributed per-connection locking, recovery when persistence fails, multi-instance coordination, and tenant isolation. Make logout or disconnect invalidate continuing refresh access as well as clear local state.
65
51
 
66
52
  If a credential may have been exposed, stop using it, revoke it, rotate the relevant client secret, review logs without copying secret values, and require reauthorization when the grant can no longer be trusted.
67
53
 
@@ -8,8 +8,6 @@ Teal boxes show the normal token lifecycle. The amber box marks a terminal failu
8
8
 
9
9
  ## Determine expiration
10
10
 
11
- Keep each token set associated with the application user and the authorized Lunch Money user and budgeting account pair. Renewing credentials does not change that pair; selecting another budgeting account requires a new authorization. See [users, budgeting accounts, and access tokens](/oauth/concepts#users-budgeting-accounts-and-access-tokens).
12
-
13
11
  Access tokens are deliberately short-lived. Record when the token response arrives and add its `expires_in` duration to determine the expected expiry. Refresh slightly before that point while accounting for clock skew. Do not parse the opaque access token or assume a fixed lifetime.
14
12
 
15
13
  ## Refresh access
@@ -59,7 +57,7 @@ Do not paste a real client secret or token directly into a command where it may
59
57
 
60
58
  Revocation is different from expiration: expiration ends one credential naturally, while revocation deliberately removes access. Deleting or disabling an application and loss of user access can also make tokens unusable.
61
59
 
62
- A Lunch Money user can also revoke an application's access from the [Connected Apps page](https://my.lunchmoney.app/connected-apps). User revocation applies to the selected budgeting-account connection. Your application should treat the resulting authentication failure as terminal for that connection and ask the user to authorize it again when they want to reconnect. Keep connections to different Lunch Money budgeting accounts for the same application user independent.
60
+ A Lunch Money user can also revoke an application's access from the [Connected Apps page](https://my.lunchmoney.app/connected-apps). Your application should treat the resulting authentication failure as terminal and ask the user to authorize again when they want to reconnect.
63
61
 
64
62
  ## Recovery rules
65
63
 
@@ -84,12 +84,12 @@ If a successful authorization-code exchange does not include a refresh token, co
84
84
  Treat an OAuth `401` as an unknown access-token failure unless a refresh request establishes what happened. When an eligible refresh token is available, attempt one refresh and handle the token endpoint's result, which uses the OAuth format shown above rather than the v2 API format:
85
85
 
86
86
  1. On success, save the replacement tokens and retry the API request once. The access token had merely expired.
87
- 2. On `invalid_grant`, treat that connection as revoked: mark the connection for the selected user/account as inactive and discard its tokens. Prompt the user to authorize that connection again the next time they need it rather than repeatedly interrupting them. Leave the user's other budgeting-account connections unchanged.
87
+ 2. On `invalid_grant`, treat the authorization as revoked: mark that user's Lunch Money connection as inactive and discard its tokens. Prompt the user to authorize again the next time they sign in rather than repeatedly interrupting them.
88
88
  3. On `invalid_client`, stop requests for every user of the client and contact [developer support](mailto:developer-support@lunchmoney.app). Lunch Money may have disabled the client; retrying or asking users to authorize again will not help.
89
89
 
90
90
  If no eligible refresh token is available, discard the rejected access token and ask the user to authorize again.
91
91
 
92
- An OAuth access token can fail because it expired, access was revoked, the client was disabled, the token was revoked or rotated, or the user lost access to the budgeting account. Every OAuth access-token failure returns the same generic `401` response:
92
+ An OAuth access token can fail because it expired, access was revoked, the client was disabled, the user reauthorized the application, a token was revoked or rotated, or the user lost access to the budgeting account. Every OAuth access-token failure returns the same generic `401` response:
93
93
 
94
94
  ```http
95
95
  HTTP/1.1 401
@@ -135,6 +135,18 @@ The `scope` parameter names every scope the endpoint requires, including any the
135
135
 
136
136
  Adding `scope` to an authorization URL cannot upgrade or narrow a grant. Lunch Money ignores the requested value and uses the client's complete registered scope set. To change scopes, create a replacement client, test all functionality, complete any required review, update the deployed client ID and credentials, and send every existing user through authorization again.
137
137
 
138
+ ## Client-management failures
139
+
140
+ The Developer Portal can return structured errors when you register clients, create client secrets, or submit a client for review. These errors use the Lunch Money response format, not OAuth protocol errors such as `invalid_grant`.
141
+
142
+ | Status and code | Meaning | What to do |
143
+ | --- | --- | --- |
144
+ | `422 quota_exceeded`, field `clients` | You already own 25 non-deleted OAuth clients. | Delete a client you no longer use before registering another. |
145
+ | `422 quota_exceeded`, field `secrets` | The client already has three non-revoked secrets. Expired secrets still count. | Revoke an obsolete or expired secret before creating another. |
146
+ | `429 review_quota_exceeded` | You have made five initial review submissions across your clients in the rolling 24-hour window. | Wait until the time shown in the Developer Portal before submitting again. API clients should also respect the `Retry-After` response header. |
147
+
148
+ Cancelled submissions, rejected-client resubmissions, and submissions for clients later deleted still count toward the review limit. Reviews opened automatically after an active client's identity changes do not count.
149
+
138
150
  ## Local callback failures
139
151
 
140
152
  For local development, use a supported loopback host: `localhost`, `127.0.0.1`, or `[::1]`. Matching depends on the client type:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunch-money/developer-docs",
3
- "version": "2.11.2-preview.4",
3
+ "version": "2.11.2-preview.5",
4
4
  "description": "Developer documentation content for Lunch Money APIs",
5
5
  "exports": {
6
6
  ".": "./package.json",
@@ -23,10 +23,10 @@
23
23
  <path class="flow user-flow" d="M560 200 H940"/><rect class="step-bg" x="652" y="178" width="196" height="28" rx="6"/><text class="step" x="750" y="197" text-anchor="middle">2. Request authorization</text>
24
24
  <path class="flow lm-flow" d="M950 260 H570"/><rect class="step-bg" x="640" y="238" width="240" height="28" rx="6"/><text class="step" x="760" y="257" text-anchor="middle">3. Show sign-in, when needed</text>
25
25
  <path class="flow user-flow" d="M560 320 H940"/><rect class="step-bg" x="605" y="298" width="290" height="28" rx="6"/><text class="step" x="750" y="317" text-anchor="middle">4. Sign in directly with Lunch Money</text>
26
- <path class="flow lm-flow" d="M950 380 H570"/><rect class="step-bg" x="545" y="358" width="430" height="28" rx="6"/><text class="step" x="760" y="377" text-anchor="middle">5. Present budgeting-account selector and permissions</text>
26
+ <path class="flow lm-flow" d="M950 380 H570"/><rect class="step-bg" x="590" y="358" width="340" height="28" rx="6"/><text class="step" x="760" y="377" text-anchor="middle">5. Present account and permission choices</text>
27
27
  <path class="flow user-flow" d="M560 440 H940"/><rect class="step-bg" x="585" y="418" width="330" height="28" rx="6"/><text class="step" x="750" y="437" text-anchor="middle">6. Select budgeting account and approve</text>
28
28
  <path class="flow lm-flow" d="M950 500 H180"/><rect class="step-bg" x="385" y="478" width="360" height="28" rx="6"/><text class="step" x="565" y="497" text-anchor="middle">7. Redirect to callback with authorization code</text>
29
29
  <path class="flow app-flow" d="M170 580 H940"/><rect class="step-bg" x="335" y="558" width="460" height="28" rx="6"/><text class="step" x="565" y="577" text-anchor="middle">8. Exchange code with PKCE (+ client secret for confidential client)</text>
30
30
  <path class="flow lm-flow" d="M950 640 H180"/><rect class="step-bg" x="385" y="618" width="360" height="28" rx="6"/><text class="step" x="565" y="637" text-anchor="middle">9. Return access token + optional refresh token</text>
31
- <path class="flow app-flow" d="M170 710 H940"/><rect class="step-bg" x="400" y="688" width="330" height="28" rx="6"/><text class="step" x="565" y="707" text-anchor="middle">10. Call the V2 API for that user and account</text>
31
+ <path class="flow app-flow" d="M170 710 H940"/><rect class="step-bg" x="466" y="688" width="198" height="28" rx="6"/><text class="step" x="565" y="707" text-anchor="middle">10. Call the V2 API</text>
32
32
  </svg>