from allauth.socialaccount import providers
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider


class FoursquareAccount(ProviderAccount):
    def get_profile_url(self):
        return 'https://foursquare.com/user/' \
            + self.account.extra_data.get('id')

    def get_avatar_url(self):
        return self.account.extra_data.get('photo')


class FoursquareProvider(OAuth2Provider):
    id = 'foursquare'
    name = 'Foursquare'
    package = 'allauth.socialaccount.providers.foursquare'
    account_class = FoursquareAccount

    def extract_uid(self, data):
        return str(data['id'])

    def extract_common_fields(self, data):
        return dict(first_name=data.get('firstname'),
                    last_name=data.get('lastname'),
                    email=data.get('contact').get('email'))


providers.registry.register(FoursquareProvider)

allauth/socialaccount/providers/foursquare/provider.py
from allauth.socialaccount import providers
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider


class FoursquareAccount(ProviderAccount):
    def get_profile_url(self):
        return 'https://foursquare.com/user/' \
            + self.account.extra_data.get('id')

    def get_avatar_url(self):
        return self.account.extra_data.get('photo')

    def to_str(self):
        dflt = super(FoursquareAccount, self).to_str()
        return self.account.extra_data.get('name', dflt)


class FoursquareProvider(OAuth2Provider):
    id = 'foursquare'
    name = 'Foursquare'
    package = 'allauth.socialaccount.providers.foursquare'
    account_class = FoursquareAccount

    def extract_uid(self, data):
        return str(data['id'])

    def extract_common_fields(self, data):
        return dict(first_name=data.get('firstname'),
                    last_name=data.get('lastname'),
                    email=data.get('contact').get('email'))


providers.registry.register(FoursquareProvider)

allauth/socialaccount/providers/foursquare/provider.py
diff --git a/allauth/socialaccount/providers/foursquare/provider.py b/allauth/socialaccount/providers/foursquare/provider.py
index 0ed3f8a6ca..fb0bd89f16 100644
--- a/allauth/socialaccount/providers/foursquare/provider.py
+++ b/allauth/socialaccount/providers/foursquare/provider.py
@@ -11,6 +11,10 @@ def get_profile_url(self):
     def get_avatar_url(self):
         return self.account.extra_data.get('photo')
 
+    def to_str(self):
+        dflt = super(FoursquareAccount, self).to_str()
+        return self.account.extra_data.get('name', dflt)
+
 
 class FoursquareProvider(OAuth2Provider):
     id = 'foursquare'

Foursquare Name
Hello the foursquare connect ist connecting fine but is displaying Foursquare as the connected name. How can i change that?

