Add LinkedIn OAuth connect with portal-saved app credentials.
Replace manual token paste with Authorization Code flow; store Client ID/secret in the DB from the social accounts UI and surface a copyable callback URL for LinkedIn Auth setup.
This commit is contained in:
@@ -10,6 +10,29 @@ class Platform(models.TextChoices):
|
||||
LINKEDIN = "linkedin", "LinkedIn"
|
||||
|
||||
|
||||
class SocialAppCredentials(UUIDPrimaryKeyModel, TimeStampedModel):
|
||||
"""
|
||||
Developer-app OAuth credentials entered in the portal (not env).
|
||||
|
||||
client_secret is Fernet-encrypted. One row per platform.
|
||||
"""
|
||||
|
||||
platform = models.CharField(max_length=16, choices=Platform.choices, unique=True)
|
||||
client_id = models.CharField(max_length=255, blank=True)
|
||||
encrypted_client_secret = models.TextField(blank=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "social app credentials"
|
||||
ordering = ["platform"]
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"{self.platform} app credentials"
|
||||
|
||||
@property
|
||||
def is_configured(self) -> bool:
|
||||
return bool(self.client_id and self.encrypted_client_secret)
|
||||
|
||||
|
||||
class SocialAccount(UUIDPrimaryKeyModel, TimeStampedModel):
|
||||
platform = models.CharField(max_length=16, choices=Platform.choices)
|
||||
label = models.CharField(max_length=120)
|
||||
|
||||
Reference in New Issue
Block a user