@aws/nx-plugin 1.0.0-rc.20 → 1.0.0-rc.21

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/nx-plugin",
3
- "version": "1.0.0-rc.20",
3
+ "version": "1.0.0-rc.21",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/awslabs/nx-plugin-for-aws.git",
@@ -105,7 +105,7 @@ const useCreateTestAgentClient = (): TestAgent => {
105
105
  const user = auth?.user;
106
106
  const cognitoClient: typeof fetch = (url, init) => {
107
107
  const headers = new Headers(init?.headers);
108
- headers.set('Authorization', \`Bearer \${user?.id_token}\`);
108
+ headers.set('Authorization', \`Bearer \${user?.access_token}\`);
109
109
  return fetch(url, { ...init, headers });
110
110
  };
111
111
  return useMemo(
@@ -4647,6 +4647,9 @@ resource "aws_api_gateway_method" "proxy_method" {
4647
4647
 
4648
4648
  authorization = "COGNITO_USER_POOLS"
4649
4649
  authorizer_id = aws_api_gateway_authorizer.cognito_authorizer.id
4650
+ # Accept access tokens from both sign-in flows: 'openid' (Cognito hosted UI)
4651
+ # and 'aws.cognito.signin.user.admin' (Cognito admin/SRP auth APIs).
4652
+ authorization_scopes = ["openid", "aws.cognito.signin.user.admin"]
4650
4653
 
4651
4654
  request_parameters = {
4652
4655
  "method.request.path.proxy" = true
@@ -114,7 +114,7 @@ const useCreateTestApiClient = (): TestApi => {
114
114
  const user = auth?.user;
115
115
  const cognitoClient: typeof fetch = (url, init) => {
116
116
  const headers = new Headers(init?.headers);
117
- headers.set('Authorization', \`Bearer \${user?.id_token}\`);
117
+ headers.set('Authorization', \`Bearer \${user?.access_token}\`);
118
118
  return fetch(url, { ...init, headers });
119
119
  };
120
120
  return useMemo(
@@ -105,7 +105,7 @@ const useCreateTestApiClient = (): TestApi => {
105
105
  const user = auth?.user;
106
106
  const cognitoClient: typeof fetch = (url, init) => {
107
107
  const headers = new Headers(init?.headers);
108
- headers.set('Authorization', \`Bearer \${user?.id_token}\`);
108
+ headers.set('Authorization', \`Bearer \${user?.access_token}\`);
109
109
  return fetch(url, { ...init, headers });
110
110
  };
111
111
  return useMemo(
@@ -127,6 +127,9 @@ export class TestApi<
127
127
  authorizer: new CognitoUserPoolsAuthorizer(scope, 'TestApiAuthorizer', {
128
128
  cognitoUserPools: [props.identity.userPool],
129
129
  }),
130
+ // Accept access tokens from both sign-in flows: 'openid' (Cognito hosted UI)
131
+ // and 'aws.cognito.signin.user.admin' (Cognito admin/SRP auth APIs).
132
+ authorizationScopes: ['openid', 'aws.cognito.signin.user.admin'],
130
133
  },
131
134
  deployOptions: {
132
135
  tracingEnabled: true,
@@ -2197,6 +2200,9 @@ resource "aws_api_gateway_method" "proxy_method" {
2197
2200
 
2198
2201
  authorization = "COGNITO_USER_POOLS"
2199
2202
  authorizer_id = aws_api_gateway_authorizer.cognito_authorizer.id
2203
+ # Accept access tokens from both sign-in flows: 'openid' (Cognito hosted UI)
2204
+ # and 'aws.cognito.signin.user.admin' (Cognito admin/SRP auth APIs).
2205
+ authorization_scopes = ["openid", "aws.cognito.signin.user.admin"]
2200
2206
 
2201
2207
  request_parameters = {
2202
2208
  "method.request.path.proxy" = true
@@ -478,6 +478,9 @@ export class TestApi<
478
478
  authorizer: new CognitoUserPoolsAuthorizer(scope, 'TestApiAuthorizer', {
479
479
  cognitoUserPools: [props.identity.userPool],
480
480
  }),
481
+ // Accept access tokens from both sign-in flows: 'openid' (Cognito hosted UI)
482
+ // and 'aws.cognito.signin.user.admin' (Cognito admin/SRP auth APIs).
483
+ authorizationScopes: ['openid', 'aws.cognito.signin.user.admin'],
481
484
  },
482
485
  deployOptions: {
483
486
  tracingEnabled: true,
@@ -5641,6 +5644,9 @@ resource "aws_api_gateway_method" "proxy_method" {
5641
5644
 
5642
5645
  authorization = "COGNITO_USER_POOLS"
5643
5646
  authorizer_id = aws_api_gateway_authorizer.cognito_authorizer.id
5647
+ # Accept access tokens from both sign-in flows: 'openid' (Cognito hosted UI)
5648
+ # and 'aws.cognito.signin.user.admin' (Cognito admin/SRP auth APIs).
5649
+ authorization_scopes = ["openid", "aws.cognito.signin.user.admin"]
5644
5650
 
5645
5651
  request_parameters = {
5646
5652
  "method.request.path.proxy" = true
@@ -43,7 +43,7 @@ export const TestApiClientProvider: FC<PropsWithChildren> = ({ children }) => {
43
43
  eventSourceOptions: async ({ op }) => {
44
44
  return {
45
45
  headers: {
46
- Authorization: \`Bearer \${user?.id_token}\`,
46
+ Authorization: \`Bearer \${user?.access_token}\`,
47
47
  },
48
48
  };
49
49
  },
@@ -51,7 +51,7 @@ export const TestApiClientProvider: FC<PropsWithChildren> = ({ children }) => {
51
51
  false: httpLink({
52
52
  url: apiUrl,
53
53
  headers: {
54
- Authorization: \`Bearer \${user?.id_token}\`,
54
+ Authorization: \`Bearer \${user?.access_token}\`,
55
55
  },
56
56
  }),
57
57
  }),
@@ -345,7 +345,7 @@ export const TestApiClientProvider: FC<PropsWithChildren> = ({ children }) => {
345
345
  const linkOptions: HTTPLinkOptions<any> = {
346
346
  url: apiUrl,
347
347
  headers: {
348
- Authorization: \`Bearer \${user?.id_token}\`,
348
+ Authorization: \`Bearer \${user?.access_token}\`,
349
349
  },
350
350
  };
351
351
 
@@ -60,7 +60,7 @@ export const <%= apiNameClassName %>ClientProvider: FC<PropsWithChildren> = ({
60
60
  <%_ } else if (auth === 'cognito') { _%>
61
61
  return {
62
62
  headers: {
63
- Authorization: `Bearer ${user?.id_token}`,
63
+ Authorization: `Bearer ${user?.access_token}`,
64
64
  },
65
65
  };
66
66
  <%_ } else if (auth === 'custom') { _%>
@@ -75,7 +75,7 @@ export const <%= apiNameClassName %>ClientProvider: FC<PropsWithChildren> = ({
75
75
  fetch: sigv4Client.fetch,
76
76
  <%_ } else if (auth === 'cognito') { _%>
77
77
  headers: {
78
- Authorization: `Bearer ${user?.id_token}`,
78
+ Authorization: `Bearer ${user?.access_token}`,
79
79
  },
80
80
  <%_ } else if (auth === 'custom') { _%>
81
81
  // TODO: Add headers required by your custom authorizer
@@ -92,7 +92,7 @@ export const <%= apiNameClassName %>ClientProvider: FC<PropsWithChildren> = ({
92
92
  fetch: sigv4Client.fetch,
93
93
  <%_ } else if (auth === 'cognito') { _%>
94
94
  headers: {
95
- Authorization: `Bearer ${user?.id_token}`,
95
+ Authorization: `Bearer ${user?.access_token}`,
96
96
  },
97
97
  <%_ } else if (auth === 'custom') { _%>
98
98
  // TODO: Add headers required by your custom authorizer
@@ -235,6 +235,9 @@ export class <%= apiNameClassName %><
235
235
  authorizer: new CognitoUserPoolsAuthorizer(scope, '<%= apiNameClassName %>Authorizer', {
236
236
  cognitoUserPools: [props.identity.userPool],
237
237
  }),
238
+ // Accept access tokens from both sign-in flows: 'openid' (Cognito hosted UI)
239
+ // and 'aws.cognito.signin.user.admin' (Cognito admin/SRP auth APIs).
240
+ authorizationScopes: ['openid', 'aws.cognito.signin.user.admin'],
238
241
  <%_ } else if (auth === 'custom') { _%>
239
242
  authorizationType: AuthorizationType.CUSTOM,
240
243
  authorizer: new TokenAuthorizer(scope, '<%= apiNameClassName %>TokenAuthorizer', {
@@ -413,6 +413,9 @@ resource "aws_api_gateway_method" "proxy_method" {
413
413
  <%_ } else if (auth === 'cognito') { _%>
414
414
  authorization = "COGNITO_USER_POOLS"
415
415
  authorizer_id = aws_api_gateway_authorizer.cognito_authorizer.id
416
+ # Accept access tokens from both sign-in flows: 'openid' (Cognito hosted UI)
417
+ # and 'aws.cognito.signin.user.admin' (Cognito admin/SRP auth APIs).
418
+ authorization_scopes = ["openid", "aws.cognito.signin.user.admin"]
416
419
  <%_ } else if (auth === 'custom') { _%>
417
420
  authorization = "CUSTOM"
418
421
  authorizer_id = aws_api_gateway_authorizer.custom_authorizer.id
@@ -39,7 +39,7 @@ const useCreate<%- apiNameClassName %>Client = (): <%- apiNameClassName %> => {
39
39
  const user = auth?.user;
40
40
  const cognitoClient: typeof fetch = (url, init) => {
41
41
  const headers = new Headers(init?.headers);
42
- headers.set('Authorization', `Bearer ${user?.id_token}`);
42
+ headers.set('Authorization', `Bearer ${user?.access_token}`);
43
43
  return fetch(url, { ...init, headers });
44
44
  };
45
45
  <%_ } _%>