aws-amplify

How to access Cognito Userpool from inside a lambda function?

别等时光非礼了梦想. 提交于 2021-01-29 13:47:56
问题 I'm using AWS Amplify for authentication in my app. I'm using email address as username and phone number for MFA. But, I also need the phone numbers to be unique, so I created this pre-signup lambda trigger: const aws = require('aws-sdk'); exports.handler = async (event, context, callback) => { const cognito = new aws.CognitoIdentityServiceProvider(); const params = { AttributesToGet: [], Filter: `phone_number = "${event.request.userAttributes.phone_number}"`, Limit: 1, UserPoolId: event

How to implement conditional rendering functionality?

泪湿孤枕 提交于 2021-01-29 06:28:50
问题 Using apollo's useQuery, I can implement conditional rendering based on whether my data is loading / it result an error / it is laoded, like this: function Dogs({ onDogSelected }) { const { loading, error, data } = useQuery(GET_DOGS); if (loading) return 'Loading...'; if (error) return `Error! ${error.message}`; return ( <select name="dog" onChange={onDogSelected}> {data.dogs.map(dog => ( <option key={dog.id} value={dog.breed}> {dog.breed} </option> ))} </select> ); } How do I implement the

How to implement conditional rendering functionality?

▼魔方 西西 提交于 2021-01-29 06:22:17
问题 Using apollo's useQuery, I can implement conditional rendering based on whether my data is loading / it result an error / it is laoded, like this: function Dogs({ onDogSelected }) { const { loading, error, data } = useQuery(GET_DOGS); if (loading) return 'Loading...'; if (error) return `Error! ${error.message}`; return ( <select name="dog" onChange={onDogSelected}> {data.dogs.map(dog => ( <option key={dog.id} value={dog.breed}> {dog.breed} </option> ))} </select> ); } How do I implement the

dispatch is not accessible from useContext

橙三吉。 提交于 2021-01-28 08:23:28
问题 i have simple store import React, { createContext, useReducer } from "react"; import Reducer from "./UserReducer"; const initialState = { user: {}, error: null }; const Store = ({ children }) => { const [state, dispatch] = useReducer(Reducer, initialState); return ( <Context.Provider value={[state, dispatch]}> {children} </Context.Provider> ); }; export const Context = createContext(initialState); export default Store; i have wrapped my app with it like <Store> <ThemeProvider theme={Theme}>

How can I force a cognito token refresh from the client

喜欢而已 提交于 2021-01-27 13:36:31
问题 I am using aws amplify and I know that the tokens get automatically refreshed when needed and that that is done behind the scenes. What I need to do is change a custom attribute on the user in the cognito user pool via a Lambda backend process. This I can do, and it is working. However, the web client user never sees this new custom attribute and I am thinking the only way they can see it is if the token gets refreshed since the value is stored within the JWT token. 回答1: Undocumented, but you

How can I force a cognito token refresh from the client

点点圈 提交于 2021-01-27 13:27:04
问题 I am using aws amplify and I know that the tokens get automatically refreshed when needed and that that is done behind the scenes. What I need to do is change a custom attribute on the user in the cognito user pool via a Lambda backend process. This I can do, and it is working. However, the web client user never sees this new custom attribute and I am thinking the only way they can see it is if the token gets refreshed since the value is stored within the JWT token. 回答1: Undocumented, but you

How to mock AWS Amplify library in Angular?

≡放荡痞女 提交于 2021-01-07 04:13:52
问题 I am getting an error that seems to come from AWS Amplify when I run the suite of tests with Karma. AuthEffects login √ should not dispatch any action √ should call setItem on LocalStorageService Chrome 78.0.3904 (Windows 10.0.0) ERROR An error was thrown in afterAll Uncaught TypeError: Cannot read property 'clientMetadata' of undefined thrown From that I suppose that this error is thrown from the last test that was launched: AuthEffects In my AuthEffects, I had to do that to make AWS amplify

How to mock AWS Amplify library in Angular?

♀尐吖头ヾ 提交于 2021-01-07 04:13:16
问题 I am getting an error that seems to come from AWS Amplify when I run the suite of tests with Karma. AuthEffects login √ should not dispatch any action √ should call setItem on LocalStorageService Chrome 78.0.3904 (Windows 10.0.0) ERROR An error was thrown in afterAll Uncaught TypeError: Cannot read property 'clientMetadata' of undefined thrown From that I suppose that this error is thrown from the last test that was launched: AuthEffects In my AuthEffects, I had to do that to make AWS amplify

How to mock AWS Amplify library in Angular?

允我心安 提交于 2021-01-07 04:12:33
问题 I am getting an error that seems to come from AWS Amplify when I run the suite of tests with Karma. AuthEffects login √ should not dispatch any action √ should call setItem on LocalStorageService Chrome 78.0.3904 (Windows 10.0.0) ERROR An error was thrown in afterAll Uncaught TypeError: Cannot read property 'clientMetadata' of undefined thrown From that I suppose that this error is thrown from the last test that was launched: AuthEffects In my AuthEffects, I had to do that to make AWS amplify

AWS Cognito hosted UI and Amplify Auth with authorization code OAuth flow

不打扰是莪最后的温柔 提交于 2021-01-03 04:15:46
问题 I have a Vue.js webapp that I am trying to add simple authentication to using AWS Cognito and Amplify Auth. I have my user pool set up with "Authorization code grant" enabled for the OAuth flow. I also have the redirect URL set as https://example.auth.us-east-2.amazoncognito.com/login?response_type=code&client_id=XXXXXXXX&redirect_uri=https://example.com/auth/verify for the hosted UI. This is what's within the page the hosted UI redirects to: import { Auth } from "aws-amplify"; export default