fix(auth): oauth redirect flow#67
Conversation
chore: add security workflow and update gitignore to exclude sensitiv…
…anches--main--components--vite_react_shadcn_ts chore(main): release 1.1.0
|
@Prime-victor is attempting to deploy a commit to the jumalaw98's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
jumalaw98
left a comment
There was a problem hiding this comment.
Thanks for the submission. There are a couple of issues that need to be addressed before this can be merged:
- Use
globalThisinstead ofwindow
src/hooks/useAuth.tsx
Sonar is correctly flagging this.
Using window assumes a browser-only environment. This reduces portability and can break in non-browser contexts (e.g., SSR, Node.js, or web workers). globalThis is the standardized way to access the global scope across all JavaScript environments.
Why this matters:
Ensures environment-agnostic code
Improves compatibility with SSR and testing environments
Aligns with modern JavaScript best practices
Suggested change:
const baseUrl = configuredAppUrl || globalThis.location?.origin;
And in the fallback:
return globalThis.location?.origin.replace(//$/, '');
(Using optional chaining adds extra safety in case location is not defined.)
- Pull Request Title Convention (Blocking)
The PR title does not follow the required conventional commits format, which is causing the semantic PR check to fail:
Current:
Fix/auth oauth redirect
Issue:
Missing proper conventional commit prefix format
Expected format:
fix(auth): oauth redirect
Why this matters:
Enables automated versioning and changelog generation
Required by CI (action-semantic-pull-request)
Please update the PR title accordingly.
Summary
Replace window with globalThis
Update PR title to follow conventional commits
Once these are addressed, we can proceed with another review.
|
Thanks for the feedback |
|



Summary
Fixes the OAuth redirect flow so authentication returns to the configured app URL instead of whichever preview origin served the page. This also switches the Supabase client to environment-based configuration and aligns the setup docs with the actual local development port.
🏷️ Type of Change
🌍 Scope
🔗 Related Issues
Closes #
📸 Screenshots
Before:
After:
VITE_APP_URLand Supabase client config is loaded from environment variables.🧪 Testing
VITE_APP_URL=http://localhost:8080in.envnpm run devhttp://localhost:8080/dashboardon the configured app origin✅ Checklist
mainnpm run build)npm run lint)None.
📝 Notes for Reviewers
Key changes in this PR:
src/hooks/useAuth.tsxVITE_APP_URLfor auth redirect URLswindow.location.originsrc/integrations/supabase/client.tsVITE_SUPABASE_URLandVITE_SUPABASE_ANON_KEY.env.example8080One repo-specific note:
devas the integration branch, so if your workflow follows repo policy, make sure the base branch is correct before opening the PR.Summary by cubic
Fixes OAuth redirects to always return to the configured app URL and
/dashboard, not preview origins. Adds SSR-safe redirect generation and switches the Supabase client to env-based config. Updates local setup and docs to port8080with a new.env.example.Bug Fixes
VITE_APP_URLwith SSR-safe normalization and always go to/dashboardfor sign-up and OAuth; trailing slashes are removed.@supabase/supabase-js) readsVITE_SUPABASE_URLandVITE_SUPABASE_ANON_KEYand throws if missing.Migration
VITE_APP_URL=http://localhost:8080in.env.http://localhost:8080andhttp://localhost:8080/github-callback..env.exampleand fill in values, includingVITE_GITHUB_CLIENT_ID.8080for local auth and integration URLs.Written for commit f8a82ff. Summary will update on new commits.