Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Coaches can log in with Google:
login(googleToken)checks the token with Google and starts a session. Closes #70 (the session part is #82).Draft on purpose. Sign in with Google only allows http on localhost. The course VM (
http://it2810-27.idi.ntnu.no/project2/) has only http, so this does not work there, and the team has to decide how the login should work on the server before this is merged. It works locally. Everything that does not need Google (the tokens,me,refreshSession,logout) is in #82 and does not wait for this.Stacked on #82 (the session). The base is
70-session-tokens. Change the base todevwhen the others are merged.What's in it
auth/google.ts: checks the Google ID token withgoogle-auth-library(signature, expiry, issuer,aud=GOOGLE_CLIENT_ID, verified email). The token is never stored.login(googleToken): creates the coach on the first login fromsub(googleId),emailandname, keeps the name and email up to date, and returns the tokens from feat: add access tokens and rotating refresh tokens #82 and the coach. A bad token givesUNAUTHENTICATEDwithout saying why. WithoutGOOGLE_CLIENT_IDit answersNOT_IMPLEMENTED.GOOGLE_CLIENT_ID(turns the login on). The server does not start with a client id and noSESSION_SECRET.verifyGoogleToken).docs/API.md,backend/.env.example,docs/AI_USAGE.md.Testing
tsc --noEmitand 160 tests pass against a database (0 skipped); 8 are new (login.test.ts): the first login creates the coach and the next one finds it, the name and email are kept up to date, a wrong or expired Google token givesUNAUTHENTICATEDwithout saying why,loginis off without a client id, expired sessions are removed, the tokens fromloginwork, andloginover HTTP.🤖 Generated with Claude Code