oauth-2.0

Google Calendar Integration with Django

Google Calendar Integration with Django Question: Is there a fully fledged Django-based example of a Google Calendar integration? I was reading through Google’s example page but their link at the bottom is outdated. I’m specifically struggeling with the refresh token as Google’s examples focus solely on how to get the access token. That’s what I …

Total answers: 5

Sending email via Gmail & Python

Sending email via Gmail & Python Question: What is the recommended way of sending emails with Gmail and Python? There are a lot of SO threads, but most are old and also SMTP with username & password is not working any more or the user has to downgrade the security of their Gmail (for example …

Total answers: 9

Generating single access token with Django OAuth2 Toolkit

Generating single access token with Django OAuth2 Toolkit Question: I’m using the latest Django OAuth2 Toolkit (0.10.0) with Python 2.7, Django 1.8 and Django REST framework 3.3 While using the grant_type=password, I noticed some weird behavior that any time the user asks for a new access token: curl -X POST -d “grant_type=password&username=<user_name>&password=<password>” -u”<client_id>:<client_secret>” http://localhost:8000/o/token/ A …

Total answers: 4

python oauth2 client issues when trying to get authorization token

python oauth2 client issues when trying to get authorization token Question: I am trying to use OAuth2 to get an authorization token using Python to a REST API. I am successful doing so using CURL but not with python. I am using the examples provided at the following docs: https://requests-oauthlib.readthedocs.org/en/latest/oauth2_workflow.html The following is my code: …

Total answers: 2

How to test an API endpoint with Django-rest-framework using Django-oauth-toolkit for authentication

How to test an API endpoint with Django-rest-framework using Django-oauth-toolkit for authentication Question: I have a Django-rest-framework viewset/router to define an API endpoint. The viewset is defined as such: class DocumentViewSet(viewsets.ModelViewSet): permission_classes = [permissions.IsAuthenticated, TokenHasReadWriteScope] model = Document And the router is defined as router = DefaultRouter() router.register(r’documents’, viewsets.DocumentViewSet) with url pattern url(r’^api/’, include(router.urls)) I …

Total answers: 3

How can I use Django OAuth Toolkit with Python Social Auth?

How can I use Django OAuth Toolkit with Python Social Auth? Question: I’m building an API using Django Rest Framework. Later this API is supposed to be consumed by iOS and Android devices. I want to allow my users to sign-up with oauth2-providers like Facebook and Google. In this case, they shouldn’t have to create …

Total answers: 4

HTTPError 403 (Forbidden) with Django and python-social-auth connecting to Google with OAuth2

HTTPError 403 (Forbidden) with Django and python-social-auth connecting to Google with OAuth2 Question: Using python-social-auth, I get a 403: Forbiden error message after accepting access from google EDIT: I’ve recently (2017) had the same error but under a new message: 401 Client Error: Unauthorized for url: https://accounts.google.com/o/oauth2/token Asked By: damio || Source Answers: This answer …

Total answers: 3

ImportError: cannot import name SignedJwtAssertionCredentials

ImportError: cannot import name SignedJwtAssertionCredentials Question: I’m trying to access a google app through the Python Client using this code to gain authorization (private info obviously redacted): import gflags import httplib2 from apiclient.discovery import build from oauth2client.file import Storage from oauth2client.client import SignedJwtAssertionCredentials from oauth2client.tools import run f = open(‘privatekey.p12’, ‘rb’) key = f.read() f.close() …

Total answers: 8

Using Google OAuth2 with Flask

Using Google OAuth2 with Flask Question: Can anyone point me to a complete example for authenticating with Google accounts using OAuth2 and Flask, and not on App Engine? I am trying to have users give access to Google Calendar, and then use that access to retrieve information from the calendar and process it further. I …

Total answers: 9