@lunch-money/developer-docs 2.11.2-preview.7 → 2.11.2-preview.9
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.
|
@@ -34,6 +34,8 @@ Web applications normally use an HTTPS callback. If you need a callback for loca
|
|
|
34
34
|
|
|
35
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
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
|
+
|
|
37
39
|
## Register the OAuth client
|
|
38
40
|
|
|
39
41
|
Open the [new OAuth client form](/oauth/applications/new) in the Developer Portal. Then:
|
|
@@ -45,11 +47,13 @@ Open the [new OAuth client form](/oauth/applications/new) in the Developer Porta
|
|
|
45
47
|
5. Select the planned scopes.
|
|
46
48
|
6. Accept the current Lunch Money API Terms of Use and select **Register OAuth client**.
|
|
47
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
|
+
|
|
48
52
|
After registration, record the client ID in your application configuration. A client ID identifies the registration but is not a secret.
|
|
49
53
|
|
|
50
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.
|
|
51
55
|
|
|
52
|
-
A confidential web client can have
|
|
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.
|
|
53
57
|
|
|
54
58
|
You now have the client settings needed to connect your application to Lunch Money.
|
|
55
59
|
|
|
@@ -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
|
|
@@ -25,7 +25,7 @@ Use a sample application to see Lunch Money OAuth working end to end before you
|
|
|
25
25
|
> The sample uses a fixed demonstration user and in-memory stores. It does not provide real application authentication, durable multi-user isolation, production credential storage, deployment configuration, or operational controls. Review its [security guidance](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/main/SECURITY.md) and [production checklist](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/main/PRODUCTION_CHECKLIST.md) before adapting any part of it.
|
|
26
26
|
|
|
27
27
|
<!-- BEGIN GENERATED OAUTH SAMPLE WALKTHROUGH -->
|
|
28
|
-
<!-- Source: lunch-money/lm-oauth-confidential-node-example@
|
|
28
|
+
<!-- Source: lunch-money/lm-oauth-confidential-node-example@567516d5e32d89576323119bec7f40a7bee007b7:docs/WALKTHROUGH.md -->
|
|
29
29
|
## Try OAuth with your Lunch Money account
|
|
30
30
|
|
|
31
31
|
Use this walkthrough to authorize a real Lunch Money OAuth client, call the Lunch Money API, optionally refresh its credentials, revoke access, and repeat the flow. The sample is a confidential, server-side web client built with Node.js and TypeScript.
|
|
@@ -100,11 +100,11 @@ export OAUTH_REDIRECT_URI='http://localhost:4002/oauth/callback'
|
|
|
100
100
|
export LUNCH_MONEY_API_BASE_URL='{{LUNCH_MONEY_API_BASE_URL}}'
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
-
The Developer Portal replaces `{{LUNCH_MONEY_API_BASE_URL}}` with the API base URL for the environment where you registered the client. If you are reading this walkthrough in the sample repository, use the API base URL
|
|
103
|
+
The Developer Portal replaces `{{LUNCH_MONEY_API_BASE_URL}}` with the API base URL for the environment where you registered the client, so the alpha guide configures alpha explicitly. If you are reading this walkthrough in the sample repository with a production client, omit the `LUNCH_MONEY_API_BASE_URL` export; the sample defaults to `https://api.lunchmoney.dev`. For a beta or alpha client, use the exact URL supplied by Lunch Money. The client registration and API base URL must belong to the same environment. The sample uses that value for OAuth discovery, token operations, and Lunch Money API requests. A real application should also use [OAuth discovery](https://lunchmoney.dev/oauth/authorization-code#configure-lunch-money-with-discovery) instead of hard-coding authorization, token, and revocation endpoint URLs. `PORT` is optional and defaults to `4002`.
|
|
104
104
|
|
|
105
105
|
`SESSION_SECRET` is also optional for this local sample. If it is absent, the process creates a new random cookie-signing secret when it starts. Because all browser sessions, authorization attempts, and credentials are held in memory and cleared on restart, the generated secret can be cleared at the same time. A production application must instead provide a strong `SESSION_SECRET`, keep it stable across restarts, and not rotate it for each OAuth authorization.
|
|
106
106
|
|
|
107
|
-
Alternatively, copy [
|
|
107
|
+
Alternatively, copy [`env.example`](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/567516d5e32d89576323119bec7f40a7bee007b7/env.example) to `.env` as described in [Load settings from a `.env` file](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/567516d5e32d89576323119bec7f40a7bee007b7/README.md#load-settings-from-a-env-file).
|
|
108
108
|
|
|
109
109
|
> [!WARNING]
|
|
110
110
|
> **Keep credentials private**
|
|
@@ -195,7 +195,7 @@ When access is still active, revoke it first through **Disconnect active budget*
|
|
|
195
195
|
|
|
196
196
|
After the flow succeeds, connect each action you performed to the code that implemented it, then decide how those responsibilities fit into your own application.
|
|
197
197
|
|
|
198
|
-
Before adapting the code, read the repository's [OAuth code guide](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/
|
|
198
|
+
Before adapting the code, read the repository's [OAuth code guide](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/567516d5e32d89576323119bec7f40a7bee007b7/src/oauth/README.md), [security model](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/567516d5e32d89576323119bec7f40a7bee007b7/SECURITY.md), [production checklist](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/567516d5e32d89576323119bec7f40a7bee007b7/PRODUCTION_CHECKLIST.md), and [troubleshooting guide](https://github.com/lunch-money/lm-oauth-confidential-node-example/blob/567516d5e32d89576323119bec7f40a7bee007b7/TROUBLESHOOTING.md).
|
|
199
199
|
<!-- END GENERATED OAUTH SAMPLE WALKTHROUGH -->
|
|
200
200
|
|
|
201
201
|
## Understand the confidential teaching code
|
|
@@ -237,6 +237,19 @@ visible or selectable. Applications that add their own sign-in system must put
|
|
|
237
237
|
that pair inside the authenticated application user's storage and ownership
|
|
238
238
|
boundary.
|
|
239
239
|
|
|
240
|
+
The native sample defaults to the production API at
|
|
241
|
+
`https://api.lunchmoney.dev`. This Developer Portal is configured for
|
|
242
|
+
`{{LUNCH_MONEY_API_BASE_URL}}`. If this differs from production, set the
|
|
243
|
+
sample's API-base override before starting it:
|
|
244
|
+
|
|
245
|
+
```sh
|
|
246
|
+
export EXPO_PUBLIC_LUNCH_MONEY_API_BASE_URL='{{LUNCH_MONEY_API_BASE_URL}}'
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Register the OAuth client in the same environment as that API base URL. A
|
|
250
|
+
client registration from one environment cannot be used with another
|
|
251
|
+
environment's authorization server and API.
|
|
252
|
+
|
|
240
253
|
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;
|
|
241
254
|
complete the registration, development-build, authorization, `/v2/me`,
|
|
242
255
|
optional refresh, revocation, and local-reset walkthrough there.
|
package/docs/oauth/security.md
CHANGED
|
@@ -67,7 +67,7 @@ Choose only the resource scopes needed for expected features. Add `offline_acces
|
|
|
67
67
|
|
|
68
68
|
## Operate credentials safely
|
|
69
69
|
|
|
70
|
-
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.
|
|
70
|
+
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 disconnect invalidate continuing refresh access as well as clear local state.
|
|
71
71
|
|
|
72
72
|
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.
|
|
73
73
|
|
|
@@ -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:
|