···99- PAR client submission
1010- both public and confidential clients, with support for signed client attestations in the later case
11111212-Most OAuth client applications will use the high-level [ClientApp] and supporting interfaces to manage session logins, persistance, and token refreshes. Lower-level components are designed to be used in isolation if needed.
1212+Most OAuth client applications will use the high-level [ClientApp] and supporting interfaces to manage session logins, persistence, and token refreshes. Lower-level components are designed to be used in isolation if needed.
13131414This package does not contain supporting code for atproto permissions or permission sets. It treats scopes as simple strings.
1515···38383939For a real service, you would want to use a database or other peristant storage instead of [MemStore]. Otherwise all user sessions are dropped every time the process restarts.
40404141-The client metadata document needs to be served at the URL indicated by the `client_id`. This can be done statically, or dynamically generated and served from the configuation:
4141+The client metadata document needs to be served at the URL indicated by the `client_id`. This can be done statically, or dynamically generated and served from the configuration:
42424343 http.HandleFunc("GET /client-metadata.json", HandleClientMetadata)
4444···6868 http.Redirect(w, r, redirectURL, http.StatusFound)
6969 }
70707171-The service then waits for a callback request on the configured endpoint. The [ProcessCallback()] method will load the earlier request metadata from the [OAuthStore], send an initial token request to the auth server, and validate that the session is consistent with the identifier from the begining of the login flow.
7171+The service then waits for a callback request on the configured endpoint. The [ProcessCallback()] method will load the earlier request metadata from the [OAuthStore], send an initial token request to the auth server, and validate that the session is consistent with the identifier from the beginning of the login flow.
72727373 http.HandleFunc("GET /oauth/callback", HandleOAuthCallback)
7474
+1-1
atproto/auth/oauth/oauth.go
···8686 return c
8787}
88888989-// Creats a basic [ClientConfig] for use with localhost developmnet. Such a client is always public (non-confidential).
8989+// Creates a basic [ClientConfig] for use with localhost developmnet. Such a client is always public (non-confidential).
9090//
9191// The "scopes" array must include "atproto".
9292func NewLocalhostConfig(callbackURL string, scopes []string) ClientConfig {
+1-1
atproto/auth/oauth/session.go
···24242525// Persisted information about an OAuth session. Used to resume an active session.
2626type ClientSessionData struct {
2727- // Account DID for this session. Assuming only one active session per account, this can be used as "primary key" for storing and retrieving this infromation.
2727+ // Account DID for this session. Assuming only one active session per account, this can be used as "primary key" for storing and retrieving this information.
2828 AccountDID syntax.DID `json:"account_did"`
29293030 // Identifier to distinguish this particular session for the account. Server backends generally support multiple sessions for the same account. This package will re-use the random 'state' token from the auth flow as the session ID.
+1-1
atproto/auth/oauth/store.go
···8899// Interface for persisting session data and auth request data, required as part of an OAuth client app.
1010//
1111-// This interface supports multiple sessions for a single account (DID). This is helpful for traditional web app backends where a single user might log in and have concurrent sessions from mutiple browsers/devices. For situations where multiple sessions are not required, implementations of this interface could ignore the `sessionID` parameters, though this could result in clobbering of active sessions.
1111+// This interface supports multiple sessions for a single account (DID). This is helpful for traditional web app backends where a single user might log in and have concurrent sessions from multiple browsers/devices. For situations where multiple sessions are not required, implementations of this interface could ignore the `sessionID` parameters, though this could result in clobbering of active sessions.
1212//
1313// For authorization-only (authn-only) applications, the `SaveSession()` method could be a no-op.
1414//
+1-1
atproto/auth/oauth/types.go
···388388 ClientAssertion *string `url:"client_assertion"`
389389}
390390391391-// Expected respose from Auth Server token endpoint, both for initial token request and for refresh requests.
391391+// Expected response from Auth Server token endpoint, both for initial token request and for refresh requests.
392392type TokenResponse struct {
393393 Subject string `json:"sub"`
394394