Able Pro
React
React
  • ✨Overview
  • 🌱Pre-requisites
  • 🚀Quick Start
  • 📂Folder Structure
  • 🌀State Management
  • 🔒Authentication
    • Switch to Auth0
    • Switch to Firebase
    • Switch to AWS Cognito
  • 🛣️Routing
  • 📡Axios API Calls
  • 🌐Internationalization
  • 🎭Theme/Style Configuration
  • 🎨Color Presets
  • 🛠️Project Configuration
  • 📚How to's
    • Login as First Page
    • Dashboard as First Page
    • Render Menu from the backend
    • Remove menu render from Backend
    • Remove Auth
  • 🤝Integration
    • Seed
    • Comparison
  • 📦Dependencies
  • 🖌️Figma
  • 🆘Support
  • 🗓️Roadmap
  • 📅Changelog
Powered by GitBook
On this page
  1. Authentication

Switch to AWS Cognito

PreviousSwitch to FirebaseNextRouting

Last updated 2 months ago

JWT to AWS Cognito

  1. Set AWS Config

At present, AWS uses a dummy config, so we don't need to change anything, but in actual implementation, you need to set poolId and appClientId in the following file. For more detail refer to AWS here:

.env
...

## AWS

VITE_APP_AWS_POOL_ID=
VITE_APP_AWS_APP_CLIENT_ID=

...
  1. Change AuthProvider

src/App.txs
port { AWSCognitoProvider as AuthProvider } from 'contexts/AWSCognitoContext';
src/App.jxs
import { AWSCognitoProvider as AuthProvider } from 'contexts/AWSCognitoContext';
  1. Change auth Hooks

src/hooks/useAuth.ts
import AuthContext from 'contexts/AWSCognitoContext';
src/hooks/useAuth.js
import AuthContext from 'contexts/AWSCognitoContext'; 
  1. Copy login code

It's also super simple. We have provided a code that just needs to be replaced.

  • From: src\sections\auth\login\AWSCognitoLogin

  • To: src\sections\auth\auth-forms\AuthLogin.tsx

  • From: src\sections\auth\login\AWSCognitoLogin

  • To: src\sections\auth\auth-forms\AuthLogin.jsx

  1. Copy register code

We have provided a code that just needs to be replaced.

  • From: src\sections\auth\register\AWSCognitoRegister

  • To: src\sections\auth\auth-forms\AuthRegister.tsx

  • From: src\sections\auth\register\AWSCognitoRegister

  • To: src\sections\auth\auth-forms\AuthRegister.jsx

🔒
https://aws.amazon.com/cognito/