Skip to main content

Packages which makes simplier integration with MoneyMade OAuth feature

Project description

moneymade-connect-oauth-python-sdk

This package contains helpers which should be useful for integration with moneymade.io oauth feature.

Navigation



Install

pip install moneymade-connect-oauth-python-sdk



SDK initialization

Firstly, receive public and private key from moneymade.io side. You are able to get it from console dashboard. (Contact moneymade devs team to add you to your project team)

  from moneymade_connect_python_sdk import moneymade_connect

  sdk = moneymade_connect.MoneyMadeConnect(private_key='private key',
                                           public_key='public key',
                                           env='development'
                                         )



Handling oauth request security

Oauth page receives signature and payload according to oauth page design.

Data interchage is protected by signature. Payload is base64 encoded string contains userId. (The userId is a link to external user who is going to share your provider data with moneymade.io)

Use base64_to_dict sdk method to transform payload to dict:

  request_payload = sdk.base64_to_dict(payload)

Use sdk generate_signature method to generate signature for request validation:

  generated_signature = sdk.generate_signature(payload_dict) 

Full example how to validate request:

  # this is a query string value which is received by your oauth page
  received_qs = 'payload=eyJ1c2VySWQiOiJhYm&signature=fa595194c0'
  query_params = sdk.query_string_to_dict(received_qs)

  payload = query_params['payload']
  signature = query_params['signature']

  request_payload =  sdk.base64_to_dict(payload)

  if signature == sdk.generate_signature(request_payload):
    # handle success oauth validation
  else 
    # handle oauth error



Finishing oauth request

After success request validation and handling userId linking you should to finish oauth request. See docs for more info.

Finish oauth payload depends on chosen data interchage stategy.

Payload for pushing strategy contains userId and user accounts data to be shared with moneymade.io. Accounts payload schema is agnostic. (Contact moneymade.io devs team to set up it for your accounts schema sample)

Typicall payload for pushing strategy looks like:

  payload = {
    "userId": 'id your read from oauth payload',
    "accounts": [{
      "id": 'some-account-id",
      "balance": 1000,
      "name": 'Checking account 1'
    }]
  }

Payload for pushing strategy contains userId and accessToken which is used to pull your endpoint for user info. (Contact moneymade.io devs team to set up API url to fetch user data and other's security points)

Payload for pushing strategy isn't agnostic and should look like:

  payload = {
    "userId": 'id your read from oauth payload',
    "accessToken": 'access-token-to-pull-your-api'
  }



Pushing accounts data

If you chose pushing strategy, you should push moneymade.io API with user data to refresh it. You may use sdk push_accounts method to send us user's account data.

This payload schema is agnostic. (Contact moneymade.io devs team to set up it for your accounts schema sample)

Typically this payload looks like:

  payload = {
    "userId": "id your read from oauth payload before",
    "accounts": [{
      "id": 'some-account-id",
      "balance": 1000,
      "name": 'Checking account 1'
    }]
  }



Pushing transactions data

We're working on it. Cooming soon :)



Migration from V1 to V2

Use version = v2 to initialize sdk:

from moneymade_connect_python_sdk import moneymade_connect

sdk = moneymade_connect.MoneyMadeConnect(private_key='private key',
                                            public_key='public key',
                                            env='development',
                                            version='v2'
                                          )

SDK switches all logic for V2 version under the hood, you don't need to change anything on backend side. However, frontend should redirect page to callback url after handling oauth request. Use get_finish_oauth_redirect_url to get this url for received oauth-signature:

sdk.get_finish_oauth_redirect_url(oauth_signature)



Developers:

This section contains hints for sdk developers to make development easier.

Testing version publishing commands:
  1. Install dev dependencies python -m pip install --upgrade build
  2. Build the package python -m build
  3. Publish to test repository python -m twine upload --repository testpypi --skip-existing dist/*
  4. Install latest test version python -m pip install --index-url https://test.pypi.org/simple --upgrade moneymade-connect-oauth-python-sdk

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moneymade-connect-oauth-python-sdk-0.0.11.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file moneymade-connect-oauth-python-sdk-0.0.11.tar.gz.

File metadata

  • Download URL: moneymade-connect-oauth-python-sdk-0.0.11.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.10.1

File hashes

Hashes for moneymade-connect-oauth-python-sdk-0.0.11.tar.gz
Algorithm Hash digest
SHA256 03d1d49c353febbd3a6ad57af88a269ee4c571f1846486955ae34b7246ffc804
MD5 136dbaa6b06f822667db31a1aba143f6
BLAKE2b-256 79c1d09f466372bdb8b9042582be649aaac7a8e6d0a6699bf7e43ffc8f6bc1ab

See more details on using hashes here.

File details

Details for the file moneymade_connect_oauth_python_sdk-0.0.11-py3-none-any.whl.

File metadata

  • Download URL: moneymade_connect_oauth_python_sdk-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.10.1

File hashes

Hashes for moneymade_connect_oauth_python_sdk-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 b3da540eda608edbf8044732c9b279309a8e44782a396128a3f94b5046089703
MD5 6a3fbd5c105720630a2abda355409bf6
BLAKE2b-256 96999f1b028d0dcf7e5c2f1dfc8e6415197b5d5c688effbbe7b22b434a024da6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page