···521521//
522522// The returned sting will be a web URL that the user should be redirected to (in browser) to approve the auth flow.
523523func (app *ClientApp) StartAuthFlow(ctx context.Context, identifier string) (string, error) {
524524+ return app.StartAuthFlowWithUserData(ctx, identifier, "")
525525+}
526526+527527+// The same as StartAuthFlow, but accepting an additional `userData` string argument.
528528+//
529529+// This string will be persisted to the session store, along with the rest of the session metadata.
530530+//
531531+// At the end of a successful auth flow, it is accessible via the `ClientSessionData.UserData` field.
532532+func (app *ClientApp) StartAuthFlowWithUserData(ctx context.Context, identifier string, userData string) (string, error) {
524533525534 var authserverURL string
526535 var accountDID syntax.DID
···565574 if accountDID != "" {
566575 info.AccountDID = &accountDID
567576 }
577577+578578+ info.UserData = userData
568579569580 // persist auth request info
570581 app.Store.SaveAuthRequestInfo(ctx, *info)
···681692 DPoPAuthServerNonce: info.DPoPAuthServerNonce,
682693 DPoPHostNonce: info.DPoPAuthServerNonce, // bootstrap host nonce from authserver
683694 DPoPPrivateKeyMultibase: info.DPoPPrivateKeyMultibase,
695695+ UserData: info.UserData,
684696 }
685697 if err := app.Store.SaveSession(ctx, sessData); err != nil {
686698 return nil, err
+3
atproto/auth/oauth/session.go
···6161 // The secret cryptographic key generated by the client for this specific OAuth session
6262 DPoPPrivateKeyMultibase string `json:"dpop_privatekey_multibase"`
63636464+ // Additional data with user-defined purpose
6565+ UserData string `json:"user_data,omitempty"`
6666+6467 // TODO: also persist access token creation time / expiration time? In context that token might not be an easily parsed JWT
6568}
6669
+3
atproto/auth/oauth/types.go
···353353354354 // The secret cryptographic key generated by the client for this specific OAuth session
355355 DPoPPrivateKeyMultibase string `json:"dpop_privatekey_multibase"`
356356+357357+ // Additional data with user-defined purpose
358358+ UserData string `json:"user_data,omitempty"`
356359}
357360358361// The fields which are included in an initial token refresh request. These HTTP POST bodies are form-encoded, so use URL encoding syntax, not JSON.