Git Product home page Git Product logo

Comments (7)

RusEu avatar RusEu commented on September 20, 2024 4

bendspax :
add this lines to your url.py file:

url(r'^social/', include('social.apps.django_app.urls', namespace='social')),
url(r'^auth/', include('rest_framework_social_oauth2.urls')),

This should solve the problem :)

from django-rest-framework-social-oauth2.

dsrizvi avatar dsrizvi commented on September 20, 2024

Here are my settings:

"""
Django settings for beerstash project.

Generated by 'django-admin startproject' using Django 1.8.4.

For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""

Build paths inside the project like this: os.path.join(BASE_DIR, ...)

import os
from config import *

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(file)))

Quick-start development settings - unsuitable for production

See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/

SECURITY WARNING: keep the secret key used in production secret!

SECRET_KEY =***************

SECURITY WARNING: don't run with debug turned on in production!

DEBUG = True

ALLOWED_HOSTS = []

Application definition

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'oauth2_provider',
'users',
'social.apps.django_app.default',
'rest_framework_social_oauth2',

)

AUTHENTICATION_BACKENDS = (

# Facebook OAuth2
'social.backends.facebook.FacebookAppOAuth2',
'social.backends.facebook.FacebookOAuth2',

# django-rest-framework-social-oauth2
'rest_framework_social_oauth2.backends.DjangoOAuth2',

# Django
'django.contrib.auth.backends.ModelBackend',

)

SOCIAL_AUTH_PIPELINE = (
'social.pipeline.social_auth.social_details',
'social.pipeline.social_auth.social_uid',
'social.pipeline.social_auth.auth_allowed',
'social.pipeline.social_auth.social_user',
'social.pipeline.user.get_username',
'social.pipeline.user.create_user',
'social.pipeline.social_auth.associate_user',
'social.pipeline.social_auth.load_extra_data',
'social.pipeline.user.user_details'

'users.pipeline.user_details'

)

REST_FRAMEWORK = {

'DEFAULT_AUTHENTICATION_CLASSES': (
    # OAuth
    'oauth2_provider.ext.rest_framework.OAuth2Authentication',
    'rest_framework_social_oauth2.authentication.SocialAuthentication',
)

}

OAUTH2_PROVIDER = {
# this is the list of available scopes
'SCOPES': {'read': 'Read scope', 'write': 'Write scope'}
}

MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
)

ROOT_URLCONF = 'blackbox_server.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'social.apps.django_app.context_processors.backends',
'social.apps.django_app.context_processors.login_redirect',

        ],
    },
},

]

WSGI_APPLICATION = 'blackbox_server.wsgi.application'

Database

https://docs.djangoproject.com/en/1.8/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}

#Social
SOCIAL_AUTH_FACEBOOK_KEY = ***********************
SOCIAL_AUTH_FACEBOOK_SECRET = ******************
SOCIAL_AUTH_FACEBOOK_SCOPE = [
'email',
'user_friends',
'friends_location',
]
SOCIAL_AUTH_STRATEGY = 'social.strategies.django_strategy.DjangoStrategy'
SOCIAL_AUTH_STORAGE = 'social.apps.django_app.default.models.DjangoStorage'

SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/'
SOCIAL_AUTH_LOGIN_ERROR_URL = '/'

LOGIN_ERROR_URL = '/'

AUTH_PROFILE_MODULE = "users.UserProfile"

TEMPLATE_DIRS = (

os.path.join(BASE_DIR, 'templates'),

)

Internationalization

https://docs.djangoproject.com/en/1.8/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

Static files (CSS, JavaScript, Images)

https://docs.djangoproject.com/en/1.8/howto/static-files/

STATIC_URL = '/static/'

Here is my urls.py:

from django.conf.urls import patterns, include, url
from django.contrib import admin

urlpatterns = patterns(
'',
# dashboard pages
url(r'^$', 'dashboard.views.login'),
# # url(r'^home/$', 'dashboard.views.home'),
# # url(r'^logout/$', 'dashboard.views.logout'),

# # authentication
url('', include('social.apps.django_app.urls', namespace='social')),
url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),

# my apps
url(r'^admin/', include(admin.site.urls)),
url(r'^users/', include('users.urls')),

)

from django-rest-framework-social-oauth2.

dsrizvi avatar dsrizvi commented on September 20, 2024

Nevermind, figured it out.

from django-rest-framework-social-oauth2.

RusEu avatar RusEu commented on September 20, 2024

what happend ? same problem here..

from django-rest-framework-social-oauth2.

m-misseri avatar m-misseri commented on September 20, 2024

same here.

from django-rest-framework-social-oauth2.

haseebehsan avatar haseebehsan commented on September 20, 2024

bendspax :
add this lines to your url.py file:

url(r'^social/', include('social.apps.django_app.urls', namespace='social')),
url(r'^auth/', include('rest_framework_social_oauth2.urls')),

This should solve the problem :)

Also, just adding on to this, make sure you have added this in settings.py file

AUTHENTICATION_BACKENDS = (
    # Others auth providers (e.g. Google, OpenId, etc)

    # Facebook OAuth2
    'social_core.backends.facebook.FacebookAppOAuth2',
    'social_core.backends.facebook.FacebookOAuth2',

    # django-rest-framework-social-oauth2
    'rest_framework_social_oauth2.backends.DjangoOAuth2',

    # Django
    'django.contrib.auth.backends.ModelBackend',
)

from django-rest-framework-social-oauth2.

hounfodji avatar hounfodji commented on September 20, 2024

In the settings.py, add this line at the end:

DRFSO2_URL_NAMESPACE = "drfso2"

from django-rest-framework-social-oauth2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.