OAUTH QUICK START - nself-org/cli GitHub Wiki
Get OAuth authentication working in 5 minutes.
nself oauth installnself oauth enable --providers google,github- Go to Google Cloud Console
- Create project → APIs & Services → Credentials
- Create OAuth client ID (Web application)
- Add redirect URI:
http://localhost:3100/oauth/google/callback - Copy Client ID and Client Secret
- Go to GitHub Settings
- OAuth Apps → New OAuth App
- Callback URL:
http://localhost:3100/oauth/github/callback - Copy Client ID and Client Secret
nself oauth config google \
--client-id=YOUR_CLIENT_ID \
--client-secret=YOUR_CLIENT_SECRET
nself oauth config github \
--client-id=YOUR_CLIENT_ID \
--client-secret=YOUR_CLIENT_SECRETnself build
nself startVisit: http://localhost:3100/oauth/google
You should be redirected to Google login, then back to your frontend with a JWT token.
// Login button
<button onClick={() => {
window.location.href = 'http://localhost:3100/oauth/google';
}}>
Sign in with Google
</button>
// Handle callback
useEffect(() => {
const token = new URLSearchParams(window.location.search).get('token');
if (token) {
localStorage.setItem('authToken', token);
window.location.href = '/dashboard';
}
}, []);Your OAuth authentication is now working.
nself oauth enable --providers googlenself oauth config google --client-id=xxx --client-secret=xxxnself start
docker logs oauth-handlersnself oauth status
nself oauth test googleNeed help? See OAuth Setup Guide for detailed instructions.