@aiquants/auth-react-router 0.9.1 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -120,7 +120,7 @@ export const createGoogleAuthenticator = (config: AuthServerConfig): Authenticat
120
120
 
121
121
  // バックエンドでのサインアップ処理 (毎ログイン実行の挙動を保存)
122
122
  if (config.backendAuth) {
123
- await config.backendAuth.signup(provider, accessToken)
123
+ await config.backendAuth.signup(provider, accessToken, profile)
124
124
  }
125
125
 
126
126
  logger.info("Authenticated complete: ", profile.displayName)
@@ -37,8 +37,14 @@ export type SessionConfig = {
37
37
  export type BackendAuthPort = {
38
38
  /** GET /openid/verify 相当。ok なら true。 */
39
39
  verify: (provider: string, accessToken: string) => Promise<boolean>
40
- /** POST /openid/signup?overwrite_existing=true 相当 (毎ログイン実行)。 */
41
- signup: (provider: string, accessToken: string) => Promise<unknown>
40
+ /**
41
+ * POST /openid/signup?overwrite_existing=true 相当 (毎ログイン実行)。
42
+ *
43
+ * `profile` を渡すのは、サインアップ直後にホスト側が identity を必要とするためである。
44
+ * この呼び出しでユーザー行が作られるので、直後に「この人物は何に属するか」を解決したい
45
+ * ホストは、ここでプロフィールを受け取れないとトークンから引き直すしかない。
46
+ */
47
+ signup: (provider: string, accessToken: string, profile: GoogleProfileBase) => Promise<unknown>
42
48
  }
43
49
 
44
50
  /** ユーザー写真解決ポート (DB 参照等の実装はアプリ側)。キャッシュ + dedup はパッケージ内。 */