You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can map which attributes are mapped between your external identity provider and your users created in Cognito. We will be able to have the best level of protection for developers if we ensure that attribute mappings that would not work are called out by the type system.
317
+
Identity provider (IdP) services store user attributes in different formats. When using external IdPs with Amazon Cognito user pools, attribute mapping allows you to standardize these varying formats into a consistent schema.
318
318
319
-
<Callout>
319
+
Learn more about [mapping IdP attributes to user pool profiles and tokens](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-specifying-attribute-mapping.html).
320
+
321
+
<Calloutwarning>
320
322
321
-
If you specify an attribute in your authentication resource as required, and it is not allowed for your external providers, signing in with that external provider will cause an error.
323
+
**Note:** When a federated user signs in to your application, a mapping must be present for each attribute that your user pool requires. Additionally, you must also ensure that the target of each attribute mapping is mutable. Amazon Cognito will attempt to update each mapped attribute when a user signs in regardless of whether the latest value already matches the existing information. If these criteria are not met, Amazon Cognito will return an error and the sign in attempt will fail.
322
324
323
325
</Callout>
324
326
@@ -330,7 +332,7 @@ import { defineAuth } from '@aws-amplify/backend';
User attributes are defined as [Cognito Standard Attributes](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#cognito-user-pools-standard-attributes). Attributes can be configured to be _required_ for user sign-up in addition to whether the values are _mutable_. When configuring your resource to allow your users to login with `email`, an email must be specified for user sign-up and cannot be changed later. However additional attributes can be configured to be optional, and mutable after sign-up.
65
65
66
+
```ts title="amplify/auth/resource.ts"
67
+
import { defineAuth } from"@aws-amplify/backend";
68
+
69
+
exportconst auth =defineAuth({
70
+
loginWith: {
71
+
email: true,
72
+
},
73
+
userAttributes: {
74
+
// Maps to Cognito standard attribute 'address'
75
+
address: {
76
+
mutable: true,
77
+
required: true,
78
+
},
79
+
// Maps to Cognito standard attribute 'birthdate'
80
+
birthdate: {
81
+
mutable: true,
82
+
required: false,
83
+
},
84
+
// Maps to Cognito standard attribute 'email'
85
+
email: {
86
+
mutable: true,
87
+
required: true,
88
+
},
89
+
// Maps to Cognito standard attribute 'family_name'
90
+
familyName: {
91
+
mutable: true,
92
+
required: false,
93
+
},
94
+
// Maps to Cognito standard attribute 'gender'
95
+
gender: {
96
+
mutable: true,
97
+
required: false,
98
+
},
99
+
// Maps to Cognito standard attribute 'given_name'
100
+
givenName: {
101
+
mutable: true,
102
+
required: false,
103
+
},
104
+
// Maps to Cognito standard attribute 'locale'
105
+
locale: {
106
+
mutable: true,
107
+
required: false,
108
+
},
109
+
// Maps to Cognito standard attribute 'middle_name'
110
+
middleName: {
111
+
mutable: true,
112
+
required: false,
113
+
},
114
+
// Maps to Cognito standard attribute 'name'
115
+
fullname: {
116
+
mutable: true,
117
+
required: false,
118
+
},
119
+
// Maps to Cognito standard attribute 'nickname'
120
+
nickname: {
121
+
mutable: true,
122
+
required: false,
123
+
},
124
+
// Maps to Cognito standard attribute 'phone_number'
125
+
phoneNumber: {
126
+
mutable: true,
127
+
required: false,
128
+
},
129
+
// Maps to Cognito standard attribute 'picture'
130
+
profilePicture: {
131
+
mutable: true,
132
+
required: false,
133
+
},
134
+
// Maps to Cognito standard attribute 'preferred_username'
135
+
preferredUsername: {
136
+
mutable: true,
137
+
required: false,
138
+
},
139
+
// Maps to Cognito standard attribute 'profile'
140
+
profilePage: {
141
+
mutable: true,
142
+
required: false,
143
+
},
144
+
// Maps to Cognito standard attribute 'zoneinfo'
145
+
timezone: {
146
+
mutable: true,
147
+
required: false,
148
+
},
149
+
// Maps to Cognito standard attribute 'updated_at'
150
+
lastUpdateTime: {
151
+
mutable: true,
152
+
required: false,
153
+
},
154
+
// Maps to Cognito standard attribute 'website'
155
+
website: {
156
+
mutable: true,
157
+
required: false,
158
+
},
159
+
},
160
+
});
161
+
```
162
+
66
163
## Custom attributes
67
164
68
165
In addition to the provided standard attributes, you can configure [Custom Attributes](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#user-pool-settings-custom-attributes). These are attributes that are typically unique to your use case, such as a tenant ID or a user's display name. Custom attributes are identified by the `custom:` prefix:
Copy file name to clipboardExpand all lines: src/pages/[platform]/build-a-backend/functions/streaming-logs/index.mdx
+10-4
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ export function getStaticProps(context) {
30
30
};
31
31
}
32
32
33
-
Amplify enables you to stream logs from your Function directly to your terminal while running [`ampx sandbox`](/[platform]/reference/cli-commands/#npx-ampx-sandbox). To get started, specify the `--stream-function-logs` option when starting sandbox:
33
+
Amplify enables you to stream logs from your AWS Lambda functions directly to your terminal while running [`ampx sandbox`](/[platform]/reference/cli-commands/#npx-ampx-sandbox). To get started, specify the `--stream-function-logs` option when starting sandbox:
Streaming Function logs directly to your terminal enable faster debug iterations, and greater insight into your Functions' executions.
45
+
Streaming function logs directly to your terminal enable faster debug iterations, and greater insight into your functions' executions.
46
46
47
47
## Filtering
48
48
49
-
By default, Amplify will stream all of your Functions' logs. If you wish to only stream a subset of Functions you can specify a filter by Function name or a regular expression for Function names. For example, if you have a collection of [Auth triggers](/[platform]/build-a-backend/auth/customize-auth-lifecycle/triggers/) where the Function names include "auth"
49
+
By default, Amplify will stream all of your functions' logs. If you wish to only stream a subset of functions you can specify a filter by function name or a regular expression for function names. For example, if you have a collection of [Auth triggers](/[platform]/build-a-backend/auth/customize-auth-lifecycle/triggers/) where the function names include "auth".
50
+
51
+
<Calloutinfo>
52
+
53
+
When working with more than 5 functions, we recommend using the `--logs-filter` flag to filter the log output to specific functions.
When working on your local machine, you must manually load the sandbox's environment variables. First, add the environment variable in your `.env.local` file. Then, a library such as [`@dotenvx/dotenvx`](https://www.npmjs.com/package/@dotenvx/dotenvx) can load the environment variables, which you can then reference with `process.env`.
162
+
163
+
```bash title="Terminal" showLineNumbers={false}
164
+
npx dotenvx run --env-file=.env.local -- ampx sandbox
0 commit comments