Example #1
0
    def test_save_auth_token(self):
        token = {"access_token": "aaa", "token_type": "bearer"}

        s = SplitwiseWrapper(self.config_non_auth)
        s.set_access_token(token)

        # Read file back and check that saved token is identical to input `token`
        s = SplitwiseWrapper(self.config_non_auth)
        self.assertDictEqual(s._access_token, token)
Example #2
0
def auth_splitwise_redirect():
    state = request.args.get('state')
    code = request.args.get('code')

    if state is None or code is None:
        return render_error(
            500,
            "Splitwise authentication failed. Could not find `state` or `code` in response."
        )

    # Save token with SplitwiseWrapper
    splitwise = SplitwiseWrapper()
    redirect_uri = url_for("auth_splitwise_redirect", _external=True)
    token = splitwise.s.getOAuth2AccessToken(code, redirect_uri)
    splitwise.set_access_token(token)

    return redirect(url_for('auth_splitwise_info'))
Example #3
0
def auth_splitwise_logout():
    splitwise = SplitwiseWrapper()
    splitwise.set_access_token({"access_token": "", "token_type": ""})

    return redirect(url_for('index'))