d282e2bcae323a63c0d5892cf4b805b3d272491c
React File Upload with Auth0 Authentication
A simple React application that allows users to upload files to a third-party API with Auth0 authentication.
Setup Instructions
-
Install dependencies:
npm install -
Configure Auth0:
- Create an account at Auth0
- Create a new application (Single Page Application)
- Update the following values in
src/main.jsx:domain: Your Auth0 domainclientId: Your Auth0 client IDaudience: Your API identifier (if applicable)
-
Update the API endpoint:
- In
src/App.jsx, update the/api/uploadendpoint to your actual third-party API endpoint
- In
-
Run the development server:
npm run dev
Features
- Auth0 authentication (login/logout)
- File selection
- Secure file upload to third-party API with Bearer token
- Upload status feedback
How It Works
- Users log in with Auth0
- After authentication, users can select a file to upload
- When uploading, the app requests an access token from Auth0
- The file is sent to the third-party API with the access token in the Authorization header
- Upload status is displayed to the user
Customization
- Modify the
audienceandscopeinsrc/App.jsxbased on your API requirements - Update the file upload endpoint in the
handleUploadfunction - Customize the UI components as needed
Languages
JavaScript
90.8%
HTML
9.2%