@microcosmmoney/auth-react 1.0.0 → 1.0.1

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.
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createTokenExchangeHandler = createTokenExchangeHandler;
4
4
  exports.createProfileHandler = createProfileHandler;
5
5
  function createTokenExchangeHandler(config) {
6
+ if (!config.clientId || !config.clientSecret) {
7
+ throw new Error('[MicrocosmAuth] createTokenExchangeHandler: clientId and clientSecret are required. ' +
8
+ 'Ensure OAUTH_CLIENT_ID and OAUTH_CLIENT_SECRET environment variables are set on the server.');
9
+ }
6
10
  const tokenEndpoint = config.tokenEndpoint || 'https://microcosm.money/api/oauth/token';
7
11
  return async function POST(request) {
8
12
  try {
9
13
  const body = await request.json();
10
- if (!config.clientSecret) {
11
- return jsonResponse({ error: 'server_error', error_description: 'OAuth not configured' }, 500);
12
- }
13
14
  const grantType = body.grant_type || 'authorization_code';
14
15
  const tokenBody = {
15
16
  grant_type: grantType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microcosmmoney/auth-react",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Microcosm OAuth 2.0 React/Next.js adapter",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "react-dom": ">=18.0.0"
25
25
  },
26
26
  "dependencies": {
27
- "@microcosmmoney/auth-core": "^1.0.0"
27
+ "@microcosmmoney/auth-core": "^1.0.1"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/react": "^18.0.0",