Skip to content

Commit 7f4f659

Browse files
committed
adding team id details
1 parent 49d73d5 commit 7f4f659

File tree

1 file changed

+26
-6
lines changed
  • src/pages/[platform]/build-a-backend/auth/advanced-workflows

1 file changed

+26
-6
lines changed

src/pages/[platform]/build-a-backend/auth/advanced-workflows/index.mdx

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ func federateToIdentityPoolsUsingCustomIdentityId() async throws {
381381

382382
To use a shared keychain:
383383

384-
1. In Xcode, go to Project Settings → Signing & Capabilities
384+
1. In Xcode, go to Project Settings → Your Target → Signing & Capabilities
385385
2. Click +Capability
386386
3. Add Keychain Sharing capability
387387
4. Add a keychain group
@@ -390,7 +390,7 @@ To use a shared keychain:
390390
To move to the shared keychain using this new keychain access group, specify the accessGroup parameter when instantiating the `AWSCognitoAuthPlugin`. If a user is currently signed-in, they will be logged out when first using the access group:
391391

392392
```swift
393-
let accessGroup = AccessGroup(name: "\(teamID).com.example.sharedItems")
393+
let accessGroup = AccessGroup(name: "\(teamID)com.example.sharedItems")
394394
let secureStoragePreferences = AWSCognitoSecureStoragePreferences(
395395
accessGroup: accessGroup)
396396
try Amplify.add(
@@ -403,7 +403,7 @@ If you would prefer the user session to be migrated (which will allow the user t
403403

404404
```swift
405405
let accessGroup = AccessGroup(
406-
name: "\(teamID).com.example.sharedItems",
406+
name: "\(teamID)com.example.sharedItems",
407407
migrateKeychainItemsOfUserSession: true)
408408
let secureStoragePreferences = AWSCognitoSecureStoragePreferences(
409409
accessGroup: accessGroup)
@@ -421,8 +421,30 @@ To move to a different access group, update the name parameter of the AccessGrou
421421

422422
### Migrating from a Shared Keychain
423423

424-
If youd like to stop sharing state between this app and other apps, you can set the access group to be `AccessGroup.none` or `AccessGroup.none(migrateKeychainItemsOfUserSession: true)` if youd like the session to be migrated.
424+
If you'd like to stop sharing state between this app and other apps, you can set the access group to be `AccessGroup.none` or `AccessGroup.none(migrateKeychainItemsOfUserSession: true)` if you'd like the session to be migrated.
425425

426+
### Retrieving Team ID
427+
428+
First, ensure your Info.plist has the `AppIdentifierPrefix` key:
429+
430+
```xml
431+
<?xml version="1.0" encoding="UTF-8"?>
432+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
433+
<plist version="1.0">
434+
<dict>
435+
<key>AppIdentifierPrefix</key>
436+
<string>$(AppIdentifierPrefix)</string>
437+
</dict>
438+
</plist>
439+
```
440+
441+
Then, you can retrieve the team ID from your Info.plist:
442+
443+
```swift
444+
guard let teamID = Bundle.main.infoDictionary?["AppIdentifierPrefix"] as? String else {
445+
fatalError("AppIdentifierPrefix key not found in Info.plist")
446+
}
447+
```
426448

427449
</InlineFilter>
428450
<InlineFilter filters={['javascript','react-native','angular','nextjs','react','vue']}>
@@ -834,5 +856,3 @@ Amplify.configure(awsconfig, {
834856
## API reference
835857
836858
For the complete API documentation for Authentication module, visit our [API Reference](https://aws-amplify.github.io/amplify-js/api/modules/aws_amplify.auth.html)
837-
838-
</InlineFilter>

0 commit comments

Comments
 (0)