Coder Social home page Coder Social logo

Facebook authorization works locally but not on production: "Authentication credentials were not provided." about django-rest-framework-social-oauth2 HOT 4 CLOSED

realmteam avatar realmteam commented on June 10, 2024
Facebook authorization works locally but not on production: "Authentication credentials were not provided."

from django-rest-framework-social-oauth2.

Comments (4)

andreyshipilov avatar andreyshipilov commented on June 10, 2024

Ok, I have no idea what's going on, but... I tried the same SQLite DB that I use for local development on the online server. Basically I made two copies of my local database. Names them online.dev.db and online.prod.db. Configured corresponding settings to use two different files.

Then I ran ./manage.py runserver ON the online server itself from SSH, so basically running dev server online. Then from Python running locally I just did:

import requests

header = {'Authorization': 'Bearer facebook <here_is_the_actual_valid_token>'}
url = "http://localhost:8000/api/convert-token/"
rq = requests.get(url, headers=header)

print rq.text
>>> u'{"access_token":"5AkOEh8m2RA89h39MWqLPCuAXzVqPP","token_type":"Bearer","expires_in":86399,"refresh_token":"rGscLtjI78PjnrNtCYondUJuIJ75OR","scope":"read write"}'

So this uses the dev DB. Same request to "http://our-server-online.com/api/convert-token/" returns:

u'{"detail":"Authentication credentials were not provided."}'

On literally the same database... Am I going crazy?

from django-rest-framework-social-oauth2.

andreyshipilov avatar andreyshipilov commented on June 10, 2024

Ok, if I'm using the online version of the Django app with a totally clean database which has just been created, synced and superuser created (no Provider Application added yet), requesting the convert-token url with a valid access token responds with the same:

u'{"detail":"Authentication credentials were not provided."}'

...as if there is nothing coming to the server from Curl.

from django-rest-framework-social-oauth2.

andreyshipilov avatar andreyshipilov commented on June 10, 2024

Ok, looks like it was the Apache2 not accepting Authorization header. For some reason.

This helped http://stackoverflow.com/questions/18424055/authorization-header-and-apache-request-headers-function

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

from django-rest-framework-social-oauth2.

PhilipGarnero avatar PhilipGarnero commented on June 10, 2024

Well, glad you figured it out by yourself ! 👍

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.