st4lk / django-rest-social-auth

OAuth signin with django rest framework
MIT License
521 stars 122 forks source link

github, got 400 (Bad Request) when post jwt-pair #127

Open piotrkolodziejski opened 4 years ago

piotrkolodziejski commented 4 years ago

Hi,

i prepare my enviroment for rest social

`INSTALLED_APPS = [ ... "social_django", 'rest_social_auth', ] AUTHENTICATION_BACKENDS =( "social_core.backends.github.GithubOAuth2", 'django.contrib.auth.backends.ModelBackend', ) TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ ... "social_django.context_processors.backends", "social_django.context_processors.login_redirect", ]}}] SOCIAL_AUTH_GITHUB_KEY = '' SOCIAL_AUTH_GITHUB_SECRET = ''

SOCIAL_AUTH_USER_FIELDS = ['email', 'username']

SOCIAL_AUTH_GITHUB_SCOPE = ['email', ] SOCIAL_AUTH_GITHUB_PROFILE_EXTRA_PARAMS = { 'fields': 'id, name, email, age_range', } SOCIAL_AUTH_REDIRECT_IS_HTTPS = True ` but when i post on url http://127.0.0.1:8000/login/social/jwt-pair/ with body parameters { "code":"qwueyuwqe72172", "provider":"github" } i got 400 , Bad Request

piotrkolodziejski commented 4 years ago

i solve problem, this app doesnt redirect errors

SamuelNata commented 4 years ago

What was the solution? same problem here :/

SamuelNata commented 4 years ago

In my case I was sendig wrong provider on request ("google" wich is the provider for google openId, but I only had configured "google-oauth2"), once I fix that, still was using the client_id and client_secret from the wrong app so google keep responding uri mismatch response. Double check guys, dont spend 1 week like me.