feat: Oauth github and google#43
Conversation
Greptile SummaryThis PR adds GitHub and Google OAuth login/registration, replaces the old
Confidence Score: 3/5The core OAuth flow looks sound but real behavioral defects exist in the profile rendering and deep-link path that should be fixed before shipping. The LinkedIn URL construction silently produces a broken profile link for any user who enters a full URL, and the getCookie token call in the login page means the acode deep-link never carries the real token through the OAuth path. client/pages/user/index.js (LinkedIn URL), client/pages/login/index.js (httpOnly token + app deep-link), server/lib/oauth.js (missing secure cookie flag)
|
| Filename | Overview |
|---|---|
| server/apis/oauth.js | New OAuth routes for GitHub and Google — state cookie CSRF protection is in place, redirect validation added. Previously flagged issues appear resolved. |
| server/lib/oauth.js | Token issuance, provider helpers, and state generation. httpOnly added to token cookie; secure flag is missing. |
| server/apis/user.js | Adds GitHub/Google unlink endpoints and new social fields. Contains a truncated 'User already' error message. |
| server/entities/user.js | Adds OAuth ID columns, avatar_url, social fields. safeColumns returns boolean expressions for github_id/google_id. |
| client/pages/account/index.js | New combined register/edit profile page with OAuth link/unlink buttons. Error handling looks correct. |
| client/pages/login/index.js | New login page with OAuth buttons. getCookie('token') always returns null due to httpOnly flag (previously flagged). |
| client/pages/user/index.js | Refactored profile page. LinkedIn link construction breaks if user stores a full URL instead of a path. |
| client/lib/helpers.js | Adds user cache, invalidateLoggedInUser, and withRedirect. withRedirect does not URL-encode the redirect parameter. |
| server/updateSchema.js | Adds migration queries for new OAuth columns with correct unique indexes. |
| server/lib/helpers.js | Adds server-side token expiry check in getLoggedInUser — correct improvement. |
| client/main.js | Route updates and OAuth wildcard route added. Logout invalidates client-side user cache correctly. |
Reviews (6): Last reviewed commit: "feat: enhance OAuth account linking, imp..." | Re-trigger Greptile
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
…pp into ajit/feat-oauth
|
@greptile_apps review again |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
…pp into ajit/feat-oauth
|
@greptile_apps review once more |
|
@greptile_apps review once more |
| <section id='user'> | ||
| <div className='profile'> | ||
| <img ref={img} src={userImage} alt='' className='profile-image' /> | ||
| <img src={loggedInUser.avatar_url || gravatar(user.github)} alt={loggedInUser.email} className='profile-image' /> |
There was a problem hiding this comment.
Wrong user's avatar shown; crash when viewing another user's profile while logged out
The newly-added img element reads from loggedInUser instead of user. When any visitor navigates to /profile/123 without a session, loggedInUser is null and loggedInUser.avatar_url throws a TypeError before the component renders. Even when the viewer is logged in, they see their own avatar on another person's profile page. Both avatar_url and the alt attribute should reference user, the profile owner.
|
@greptile_apps review the changes |
…er profile fields
|
@greptile_apps review the changes |
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
| <div className='socials' data-show-sensitive-info={String(shouldShowSensitiveInfo)}> | ||
| {user.website && ( | ||
| <a href={user.website} target='_blank' rel='noopener'> | ||
| <span className='icon earth' /> | ||
| <span className='label'>{user.website}</span> |
There was a problem hiding this comment.
Broken link when user stores a full LinkedIn URL
The link is built as `https://linkedin.com${user.linkedin}`, expecting a stored value of /in/johndoe. If a user enters the full URL (https://linkedin.com/in/johndoe) in the edit form — which has no client- or server-side validation — the rendered href becomes https://linkedin.comhttps://linkedin.com/in/johndoe, producing a broken link on their public profile with no error surfaced to them.
No description provided.