Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google access token and refresh token are not getting saved in SocialToken model #3890

Closed
aasimmk opened this issue Jun 13, 2024 · 1 comment

Comments

@aasimmk
Copy link

aasimmk commented Jun 13, 2024

Problem:

The access and refresh token from google signup/signin are saved in SocialToken model. Nothing is reflected in Social application tokens admin page as well. Signup/Signin are working fine, social profiles are populated as expected, I am not getting any error but it's just the problems with tokens.

I am not sure if I am missing something.

Versions:

django = 4.2.x
django-allauth = 0.63.3

Settings:

SOCIALACCOUNT_PROVIDERS = {
    "google": {
        "APP": {
            "client_id": GOOGLE_OAUTH_CLIENT_ID,
            "secret": GOOGLE_OAUTH_CLIENT_SECRET,
            "key": "",
        },
        "AUTH_PARAMS": {
            "access_type": "offline",
        },
        "FETCH_USERINFO": True,
        "SCOPE": [
            "profile",
            "email",
        ],
    },
}
SOCIALACCOUNT_FORMS = {
    "disconnect": "allauth.socialaccount.forms.DisconnectForm",
    "signup": "allauth.socialaccount.forms.SignupForm",
    # "signup": "accounts.forms.SocialSignupForm",
}
SOCIALACCOUNT_ADAPTER = "accounts.adapter.SocialAccountAdapter"
SOCIALACCOUNT_AUTO_SIGNUP = True
SOCIALACCOUNT_EMAIL_AUTHENTICATION = True
SOCIALACCOUNT_STORE_TOKENS = True

Adapter

class SocialAccountAdapter(DefaultSocialAccountAdapter):
    def save_user(self, request, sociallogin, form=None):
        user = super().save_user(request, sociallogin, form=form)
        user.sign_up_method = User.SIGNUP_WALKUP
        user.save()
        return user

    def get_connect_redirect_url(self, request, socialaccount):
        return reverse("accounts:signup-organisation")
@pennersr
Copy link
Owner

Repository owner locked and limited conversation to collaborators Sep 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants