When Trying to Access the Cognito Provider to Login in React Native, Im facing two kinds of Error
- Reference Error – Readable Stream Not Found
- f is not a function
Both Occurs Randomly but either one of the error occurs every time
Version Details
“react-native”: “0.69.3”,
“@aws-sdk/client-cloudwatch-logs”: “^3.614.0”,
const client = new AWS.CognitoIdentityProvider({ region: EnvConfig.REGION })
const getTokens = async ({username, password}) => {
try {
setisLoading(true);
const {AuthenticationResult} = await client.initiateAuth({
ClientId: EnvConfig.COGNITO_CLIENT_ID,
AuthFlow: 'USER_PASSWORD_AUTH',
AuthParameters: {
USERNAME: username,
PASSWORD: password,
},
});
console.log({
access_token: AuthenticationResult.AccessToken,
id_token: AuthenticationResult.IdToken,
refresh_token: AuthenticationResult.RefreshToken,
});
setisLoading(false);
} catch (error) {
console.log(error)
setisLoading(false);
ToastMessage(error.message);
}
};
I have also. released a build with the same peice of Code and it is still working fine but the code in my machine is not working also tried to check by releasing build it is not working.
Both the released build and the debug build are running in the same branch.
Abrar Hasan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.