Local server that gives you your OAuth 2.0 tokens needed to interact with the Conta Azul's API

Overview

What's this?

This is a django project meant to be run locally that gives you your OAuth 2.0 tokens needed to interact with Conta Azul's API

Prerequisites

Creating Your Conta Azul consumer application

First of all, if you haven't done this, before getting your tokens, you need to head over to https://portaldevs.contaazul.com/ and create an application. PLEASE NOTE THAT THE APPLICATION'S REDIRECT_URI SHOULD BE SET TO http://localhost:8000/auth/get-token FOR THIS SERVER TO WORK

Setting up environment variables

After your application is created, you will need to set the following environment variables How to set up environment variables:

  • CONTA_AZUL_CLIENT_ID: The value of this environment variable should match you application's client_id

  • HASHED_CONTA_AZUL_CLIENT_CREDENTIALS: This one is a bit trickier to set up right, but shouldn't take more than 2 minutes. What you need to do is to head over to https://www.base64encode.org/ and encode to base 64 the string made of your client id and secret separated by a colon: {client_id}:{client_secret}.
    Example: QsaiBIwQWJBcHTHHcQza:MhRFOTswQlzwJUzfOATW is UXNhaUJJd1FXSkJjSFRISGNRemE6TWhSRk9Uc3dRbHp3SlV6Zk9BVFc= once encoded.
    The encoded string should be the value of this environment variable

Installing Python and Django (Ignore if already installed in your machine)

As descbribed, the server is built with Django, so you will need to have Python and it's dependencies installed to run the server.
The simplest way to do this is to install python, open a terminal in the project's root folder, and run:
pip install requirements.txt
This will install Django, the requests lib, and django's dependencies. So you will be able to run the server

How to get your tokens?

Simply run the server through the terminal with python manage.py runserver, go to http://localhost:8000/auth/authorize, log into your conta azul account and click on "Autorizar". This will generate a file called token.json in the root of the project with your credentials.

If you have any doubts or need help regarding the API (after all, the official documentation on the authentication flow is subpar to say the least), please feel free to contact me through my email: [email protected]

You might also like...
Doing the OAuth dance with style using Flask, requests, and oauthlib.

Flask-Dance Doing the OAuth dance with style using Flask, requests, and oauthlib. Currently, only OAuth consumers are supported, but this project coul

Doing the OAuth dance with style using Flask, requests, and oauthlib.

Flask-Dance Doing the OAuth dance with style using Flask, requests, and oauthlib. Currently, only OAuth consumers are supported, but this project coul

Phishing Abusing Microsoft 365 OAuth Authorization Flow
Phishing Abusing Microsoft 365 OAuth Authorization Flow

Microsoft365_devicePhish Abusing Microsoft 365 OAuth Authorization Flow for Phishing Attack This is a simple proof-of-concept script that allows an at

Abusing Microsoft 365 OAuth Authorization Flow for Phishing Attack
Abusing Microsoft 365 OAuth Authorization Flow for Phishing Attack

Microsoft365_devicePhish Abusing Microsoft 365 OAuth Authorization Flow for Phishing Attack This is a simple proof-of-concept script that allows an at

A module making it easier to manage Discord oAuth with Quart

quart_discord A module making it easier to manage Discord oAuth with Quart Install pip install git+https://github.com/xelA/quart_discord@master How to

Plotly Dash plugin to allow authentication through 3rd party OAuth providers.

dash-auth-external Integrate your dashboards with 3rd parties and external OAuth providers. Overview Do you want to build a Plotly Dash app which pull

CheckList-Api - Created with django rest framework and JWT(Json Web Tokens for Authentication)

CheckList Api created with django rest framework and JWT(Json Web Tokens for Aut

Python module for generating and verifying JSON Web Tokens

python-jwt Module for generating and verifying JSON Web Tokens. Note: From version 2.0.1 the namespace has changed from jwt to python_jwt, in order to

A Python tool to generate and refresh Amazon access tokens.

amazon_auth A Python tool to generate and refresh Amazon access tokens. Description This tool generates and outputs Amazon access and refresh tokens f

Owner
Fábio David Freitas
Back-end/Web Developer
Fábio David Freitas
Python library for generating a Mastercard API compliant OAuth signature.

oauth1-signer-python Table of Contents Overview Compatibility References Usage Prerequisites Adding the Library to Your Project Importing the Code Loa

null 23 Aug 1, 2022
This is a Token tool that gives you many options to harm the account.

Trabis-Token-Tool This is a Token tool that gives you many options to harm the account. Utilities With this tools you can do things as : ·Delete all t

Steven 2 Feb 13, 2022
The ultimate Python library in building OAuth, OpenID Connect clients and servers. JWS,JWE,JWK,JWA,JWT included.

Authlib The ultimate Python library in building OAuth and OpenID Connect servers. JWS, JWK, JWA, JWT are included. Authlib is compatible with Python2.

Hsiaoming Yang 3.4k Jan 4, 2023
A generic, spec-compliant, thorough implementation of the OAuth request-signing logic

OAuthLib - Python Framework for OAuth1 & OAuth2 *A generic, spec-compliant, thorough implementation of the OAuth request-signing logic for Python 3.5+

OAuthlib 2.5k Jan 2, 2023
A fully tested, abstract interface to creating OAuth clients and servers.

Note: This library implements OAuth 1.0 and not OAuth 2.0. Overview python-oauth2 is a python oauth library fully compatible with python versions: 2.6

Joe Stump 3k Jan 2, 2023
A generic, spec-compliant, thorough implementation of the OAuth request-signing logic

OAuthLib - Python Framework for OAuth1 & OAuth2 *A generic, spec-compliant, thorough implementation of the OAuth request-signing logic for Python 3.5+

OAuthlib 2.5k Jan 1, 2023
Doing the OAuth dance with style using Flask, requests, and oauthlib.

Flask-Dance Doing the OAuth dance with style using Flask, requests, and oauthlib. Currently, only OAuth consumers are supported, but this project coul

David Baumgold 915 Dec 28, 2022
This is a Python library for accessing resources protected by OAuth 2.0.

This is a client library for accessing resources protected by OAuth 2.0. Note: oauth2client is now deprecated. No more features will be added to the l

Google APIs 787 Dec 13, 2022
A Python library for OAuth 1.0/a, 2.0, and Ofly.

Rauth A simple Python OAuth 1.0/a, OAuth 2.0, and Ofly consumer library built on top of Requests. Features Supports OAuth 1.0/a, 2.0 and Ofly Service

litl 1.6k Dec 8, 2022
The ultimate Python library in building OAuth, OpenID Connect clients and servers. JWS,JWE,JWK,JWA,JWT included.

Authlib The ultimate Python library in building OAuth and OpenID Connect servers. JWS, JWK, JWA, JWT are included. Authlib is compatible with Python2.

Hsiaoming Yang 2.3k Feb 17, 2021