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

fix(oauth): authorised client error on fresh sessions #32

merged opened by brookjeynes.dev targeting master from push-rozvknvsxslu

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

Labels

None yet.

Participants 1
AT URI
at://did:plc:4mj54vc4ha3lh32ksxwunnbh/sh.tangled.repo.pull/3m4fshni44x22
+3 -1
Diff #0
+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 119 if ex != nil {
··· 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 121 if ex != nil {

History

1 round 0 comments
sign up or login to add to the discussion
brookjeynes.dev submitted #0
1 commit
expand
fix(oauth): authorised client error on fresh sessions
expand 0 comments
pull request successfully merged