I’m building a React application using Redux for state management and React-Router for navigation. I want to implement GitHub login functionality where users can authenticate directly through their GitHub accounts. When someone clicks the login button, they should go through GitHub’s authorization flow and then have their user information stored in my Redux state. The main challenge is that my application is completely client-side with no backend server. I’m wondering if it’s actually feasible to handle OAuth authentication purely on the frontend, or if I need to switch to a different approach like personal access tokens where users manually input their credentials. My application also needs to make requests to GitHub’s search API using application credentials. Has anyone successfully implemented GitHub OAuth in a frontend-only React setup?
yep, dealing with OAuth in a client-only app can be tricky. had a similar issue when testing it out - CORS errors were a big pain! I had to use Netlify functions too. they really helped manage the OAuth without needing a full backend.
Implementing GitHub OAuth purely on the frontend is not advisable due to security concerns, particularly regarding the client secret which must remain confidential. In my experience, I faced a similar issue where I opted for GitHub’s Personal Access Tokens. Instead of requiring users to create tokens independently, I integrated user-friendly instructions within the application, which proved effective given their familiarity with GitHub. However, for a production environment, I recommend using serverless functions to manage the OAuth process securely.
github pages or vercel could totally help you out with client-side oauth flows! but what do u really need from the github api? maybe those public endpoints could do the trick and save you from the whole oauth hassle!