Yōten: A social tracker for your language learning journey built on the atproto.

fix(oauth): authorised client error on fresh sessions

During the callback phase of oauth, we check to see if a user account
exists in the pds and if not, create one. This requires an authorised
client. This fixes an issue where the client authorised client wasn't
grabbed successfully out of the session.

Signed-off-by: brookjeynes <me@brookjeynes.dev>

+3 -1
+3 -1
internal/server/oauth/handler.go
··· 107 return 108 } 109 110 - client, err := o.AuthorizedClient(r) 111 if err != nil { 112 l.Error("failed to get authorized client", "err", err) 113 http.Redirect(w, r, "/login?error=client", http.StatusFound) 114 return 115 } 116 117 ex, _ := comatproto.RepoGetRecord(r.Context(), client, "", yoten.ActorProfileNSID, did, "self") 118 var cid *string
··· 107 return 108 } 109 110 + clientSession, err := o.ClientApp.ResumeSession(r.Context(), sessData.AccountDID, sessData.SessionID) 111 if err != nil { 112 l.Error("failed to get authorized client", "err", err) 113 http.Redirect(w, r, "/login?error=client", http.StatusFound) 114 return 115 } 116 + 117 + client := clientSession.APIClient() 118 119 ex, _ := comatproto.RepoGetRecord(r.Context(), client, "", yoten.ActorProfileNSID, did, "self") 120 var cid *string