Guest access
The Auth Plugin can be configured to automatically obtain guest credentials once the device is online so that you are able to use other categories "anonymously" without the need to sign in. You will not be able to perform user specific methods while in this state such as updating attributes, changing your password, or getting the current user. However, you can obtain the unique Identity ID which is assigned to the device through the fetchAuthSession
method described here.
Amplify Gen 2 enables guest access by default. To disable it, you can update the backend.ts
file with the following changes:
amplify/backend.ts
import { defineBackend } from '@aws-amplify/backend'import { auth } from './auth/resource'import { data } from './data/resource'
const backend = defineBackend({ auth, data,});
const { cfnIdentityPool } = backend.auth.resources.cfnResources;cfnIdentityPool.allowUnauthenticatedIdentities = false;