Laravel AT Protocol Client (alpha & unstable)
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

Support OAuth token response format in AccessToken::fromResponse()

+18
+18
src/Data/AccessToken.php
··· 12 12 public readonly ?string $handle = null, 13 13 ) {} 14 14 15 + /** 16 + * Create from API response. 17 + * 18 + * Handles both legacy createSession format (accessJwt, refreshJwt, did) 19 + * and OAuth token format (access_token, refresh_token, sub). 20 + */ 15 21 public static function fromResponse(array $data): self 16 22 { 23 + // OAuth token endpoint format 24 + if (isset($data['access_token'])) { 25 + return new self( 26 + accessJwt: $data['access_token'], 27 + refreshJwt: $data['refresh_token'] ?? '', 28 + did: $data['sub'] ?? '', 29 + expiresAt: now()->addSeconds($data['expires_in'] ?? 300), 30 + handle: null, 31 + ); 32 + } 33 + 34 + // Legacy createSession format 17 35 return new self( 18 36 accessJwt: $data['accessJwt'], 19 37 refreshJwt: $data['refreshJwt'],