-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Q workspace command #8147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Q workspace command #8147
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
50005f4
Q workspace command
offlineprogrammer 5d0617e
Update src/pages/[platform]/build-a-backend/q-developer/index.mdx
offlineprogrammer 9fde8ab
Update src/pages/[platform]/build-a-backend/q-developer/index.mdx
offlineprogrammer cc58b0c
Update src/pages/[platform]/build-a-backend/q-developer/index.mdx
offlineprogrammer 19dc638
Update src/pages/[platform]/build-a-backend/q-developer/index.mdx
offlineprogrammer 773d417
closing tag
offlineprogrammer bf6d446
Update src/pages/[platform]/build-a-backend/q-developer/index.mdx
offlineprogrammer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,219 @@ | ||
# AMPLIFYRULES | ||
|
||
- RULES THAT SHOULD BE ADHERED TO THE LAST WORD. | ||
|
||
1. EXTERNAL PROVIDERS THAT ARE AVAILABLE ARE LISTED BELOW IN THE EXAMPLE, DON'T CHANGE THE NAMING CONVENTION WHILE USING THOSE IN THE CODE GENERATION. | ||
2. DON'T FORGET TO IMPORT SECRET FOR ANY AUTHENTICATION BASED QUESTION. | ||
|
||
```typescript | ||
import { defineAuth, secret } from "@aws-amplify/backend"; | ||
``` | ||
|
||
3. CALLBACK AND LOGOUT URLS SHOULD BE INSIDE THE "EXTERNALPROVIDERS" OBJECT. | ||
4. WHILE ADDING THE CUSTOM ATTRIBUTES, IF THE ATTRIBUTE YOU ARE ADDING DOESNT BELONG TO THE STANDARD USER ATTRIBUTES LIST THEN ADD IT AS A CUSTOM ATTRIBUTE LIKE THIS "CUSTOM:ATTRIBUTE_NAME" AND THIS DOESN'T SUPPORT "REQUIRED" FIELD SO IGNORE IT WHILE GENERATING THE ANSWER. | ||
5. WHILE ADDING THE CUSTOM ATTRIBUTES, MAKE SURE TO ALWAYS ADD THE "DATATYPE" FIELD AS IT IS A REQUIRED FIELD. | ||
6. STATNDARD ATTIBUTES THAT ARE ALLOWED: `familyName`, `giveName`, `middleName`, `nickname`, `preferredUsername`, `profile`, `profilePicture`, `website`, `gender`, `birthdate`, `zoneinfo`, `locale`, `updatedAt`, `address`, `email`, `phoneNumber`, `sub`. THE `userAttributes` ARE SUPPOSED TO BE OUTSIDE THE `loginWith` OBJECT | ||
|
||
7. THE FOLLOWING IS THE REQUIRED SYNTAX FOR `externalProviders`. ONLY THE FOUR LISTED PROVIDERS BELOW ARE SUPPORTED: | ||
|
||
```typescript | ||
loginWith:{ | ||
//loginMethods | ||
externalProviders: { | ||
google: { | ||
|
||
}, | ||
signInWithApple: { | ||
}, | ||
loginWithAmazon: { | ||
|
||
}, | ||
facebook: { | ||
}, | ||
callbackUrls: [ | ||
// Callback URLs should be included inside the `externalProviders` object only, as per rule. | ||
|
||
], | ||
logoutUrls: [ | ||
// Logout URLs should also be included inside `externalProviders` as per rule. | ||
|
||
], | ||
}, | ||
} | ||
``` | ||
|
||
8. THE `userAttributes` ARE SUPPOSED TO BE OUTSIDE THE `loginWith` OBJECT | ||
`// Example configuration for user attributes and login methods | ||
loginWith: { | ||
// Specify login methods separately from user attributes, ONLY MENTION THE LOGINMETHODS THAT ARE SUPPOSED TO BE TRUE | ||
offlineprogrammer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
email: true, // Enable login with email | ||
phone: false, // Disable login with phone number | ||
},userAttributes: { | ||
email: true, // Attribute set as required | ||
phoneNumber: false, // Attribute not required | ||
givenName: true, // Attribute set as required | ||
},` | ||
9. THIS IS THE WAY TO SETUP THE MULTIFACTOR AUTHENTHICATION | ||
export const auth = defineAuth({ | ||
loginWith: { | ||
email: true, | ||
phone: true, | ||
}, | ||
multifactor: { | ||
mode: "OPTIONAL", | ||
sms: true, | ||
totp: false, | ||
}, | ||
// IMPORTANT! THE LOGIC TO RESOLVE THIS VALUE CANNOT DETERMINE WHETHER EMAIL MFA IS ENABLED WHEN OVERRIDING THE RESOURCE. | ||
// BE SURE TO PICK A RECOVERY OPTION APPROPRIATE FOR YOUR APPLICATION. | ||
accountRecovery: "EMAIL_AND_PHONE_WITHOUT_MFA", | ||
senders: { | ||
email: { | ||
fromEmail: "[email protected]", | ||
}, | ||
}, | ||
}) | ||
10. DON'T ADD THE `passwordPolicy` IN THE AUTH/RESOURCE.TS FILE. | ||
11. THE `username` SHOULD BE REPLACED WITH `userAttributes` WHEN REQUESTED TO SETUP USERNAME AS A LOGIN METHOD AS USERNAME IS NOT A VALID LOGIN METHOD ON DEFINEAUTH, FOR EXAMPLE: | ||
|
||
```typescript | ||
userAttributes: { | ||
preferredUsername: { | ||
mutable: true, | ||
required: false | ||
} | ||
} | ||
``` | ||
|
||
12. `loginWith` SUPPORTS ONLY TWO METHODS THAT IS `email` and `phone`. THERE IS NO `username` attribute to that. | ||
13. THE `callbackUrls` AND `logoutUrls` SHOULD ONLY BE MENTIONED ONCE AS MENTIONED IN RULE #7 AND NOT FOR EACH EXTERNAL PROVIDER | ||
|
||
```typescript | ||
import { defineAuth, secret } from "@aws-amplify/backend"; | ||
|
||
export const auth = defineAuth({ | ||
// Login Methods Configuration | ||
loginWith: { | ||
// Only email and phone are supported as login methods | ||
email: true, | ||
phone: true, | ||
|
||
// External Providers Configuration - all providers shown with required fields | ||
externalProviders: { | ||
// Google Authentication | ||
google: { | ||
clientId: secret("GOOGLE_CLIENT_ID"), | ||
clientSecret: secret("GOOGLE_CLIENT_SECRET"), | ||
}, | ||
// Sign in with Apple | ||
signInWithApple: { | ||
clientId: secret("SIWA_CLIENT_ID"), | ||
keyId: secret("SIWA_KEY_ID"), | ||
privateKey: secret("SIWA_PRIVATE_KEY"), | ||
teamId: secret("SIWA_TEAM_ID"), | ||
}, | ||
// Login with Amazon | ||
loginWithAmazon: { | ||
clientId: secret("LOGINWITHAMAZON_CLIENT_ID"), | ||
clientSecret: secret("LOGINWITHAMAZON_CLIENT_SECRET"), | ||
}, | ||
// Facebook Authentication | ||
facebook: { | ||
clientId: secret("FACEBOOK_CLIENT_ID"), | ||
clientSecret: secret("FACEBOOK_CLIENT_SECRET"), | ||
}, | ||
// Callback and logout URLs must be inside externalProviders | ||
callbackUrls: [ | ||
"http://localhost:3000/profile", | ||
"https://mywebsite.com/profile", | ||
], | ||
logoutUrls: ["http://localhost:3000/", "https://mywebsite.com"], | ||
}, | ||
}, | ||
|
||
// User Attributes Configuration - outside loginWith | ||
userAttributes: { | ||
// Standard attributes examples | ||
email: { | ||
mutable: true, | ||
required: true, | ||
}, | ||
phoneNumber: { | ||
mutable: true, | ||
required: false, | ||
}, | ||
givenName: { | ||
mutable: true, | ||
required: true, | ||
}, | ||
familyName: { | ||
mutable: true, | ||
required: false, | ||
}, | ||
birthdate: { | ||
mutable: true, | ||
required: false, | ||
}, | ||
// Username configuration using preferredUsername | ||
preferredUsername: { | ||
mutable: true, | ||
required: false, | ||
}, | ||
// Additional standard attributes | ||
address: { | ||
mutable: true, | ||
required: false, | ||
}, | ||
gender: { | ||
mutable: true, | ||
required: false, | ||
}, | ||
locale: { | ||
mutable: true, | ||
required: false, | ||
}, | ||
profilePicture: { | ||
mutable: true, | ||
required: false, | ||
}, | ||
website: { | ||
mutable: true, | ||
required: false, | ||
}, | ||
// Custom attributes examples - note the 'custom:' prefix and required dataType | ||
"custom:organization": { | ||
dataType: "String", | ||
mutable: true, | ||
minLen: 3, | ||
maxLen: 100, | ||
}, | ||
"custom:employeeId": { | ||
dataType: "Number", | ||
mutable: false, | ||
min: 1000, | ||
max: 9999999, | ||
}, | ||
"custom:isVerified": { | ||
dataType: "Boolean", | ||
mutable: true, | ||
}, | ||
}, | ||
|
||
// Multi-factor Authentication Configuration | ||
multifactor: { | ||
mode: "OPTIONAL", // Can be OPTIONAL or REQUIRED | ||
sms: true, | ||
totp: false, | ||
}, | ||
|
||
// Account Recovery Configuration | ||
accountRecovery: "EMAIL_AND_PHONE_WITHOUT_MFA", | ||
|
||
// Email Sender Configuration | ||
senders: { | ||
email: { | ||
fromEmail: "[email protected]", | ||
}, | ||
}, | ||
}); | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# AMPLIFYRULES | ||
|
||
1. ALWAYS MENTION WHICH FILE PATH THE USER NEED TO PASTE THE CODE IN. | ||
offlineprogrammer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
2. MAKE SURE IF IT IS IN TWO DIFFERENT FILES, YOU DIVIDE THE CODE SNIPPET AND MENTION THE FILE PATH | ||
3. IF THE FILE DOESN'T ALREADY EXIST, GIVE THE STEPS TO GENERATE THE FILES. | ||
4. COMMENT ON EVERY PIECE OF CODE THAT CAN HELP IMPROVE CODE QUALITY THAT EXPLAINS WHAT THE LINE DOES |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.