react-cognito | integrating Facebook React and Amazon Cognito | Frontend Framework library
kandi X-RAY | react-cognito Summary
kandi X-RAY | react-cognito Summary
This library should be installed using npm, and depends on React, Redux, React Router, and of course the underlying AWS packages. In a nutshell this library allows you to write all of your own forms and UI components, but abstracts out all of the interfacing with Cognito, and determining which parts of UI should be rendered.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of react-cognito
react-cognito Key Features
react-cognito Examples and Code Snippets
Community Discussions
Trending Discussions on react-cognito
QUESTION
For background I'm using react, redux, react-router(v4), react-cognito, and appsync. My application uses PrivateRoute to ensure the user has authorization for each route requested. react-cognito handles all the authentication for me and stores JWT tokens, Federated Identity temporary IAM access key / secret access key / session token in the redux store.
The AppSync tutorial assumes you are using AWS-amplify instead of react-cognito, and places the at root application level, where
ANSWER
Answered 2018-Apr-24 at 22:26You can keep using the ApolloProvider
at the root component level. The auth config will be read only when needed before making the request to the AppSync API.
Some more detail:
The object under the auth
key in the config that you pass to the AWSAppSyncClient constructor can contain different values depending on the authentication type that your API is using.
apiKey
forAPI_KEY
credentials
forAWS_IAM
jwtToken
forAMAZON_COGNITO_USER_POOLS
These three keys can contain values or functions that return a promise that will resolve with the value. The AWSAppSyncClient will get the value (or await for the promise) on every request.
It doesn't matter if at instantiation time the info is not yet in the redux-store. I haven't tested this (also, I am not familiar with react-cognito), but it would be something like this:
QUESTION
I'm new at React+Redux+Router and I'm scratching my head over how to have the user forwarded to the PrivateRoute requested after successful login.
react-cognito fires COGNITO_LOGIN
action and sets cognito.state = "LOGGED_IN"
in the store at successful login. I know react-router stores the requested route in location.state.from.pathname
, and I know that to redirect the BrowserRouter I can use history.replace()
.
I just don't know where my code goes so that it executes after the react-cognito onSubmit login function asynchronously completes, given there's no callback provided by this package.
In my login form component I tried
...ANSWER
Answered 2018-Jan-15 at 06:51The standard way of doing it with react-router-v4
is to render a which will take care of redirection.
In your case:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install react-cognito
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page