From b552539e2911422a03a7ce372d4fd61f5f863822 Mon Sep 17 00:00:00 2001 From: stupidcomputer Date: Sun, 10 Nov 2024 22:42:39 -0600 Subject: [PATCH] crap --- tfbbridge/groupme.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tfbbridge/groupme.py b/tfbbridge/groupme.py index b97cdae..060e630 100644 --- a/tfbbridge/groupme.py +++ b/tfbbridge/groupme.py @@ -21,33 +21,32 @@ def group_sharing_url_to_id(url: str) -> str: return group_id -def build_oauth_auth_url(client_id: str, state: Optional[str] = None, user_params: Optional[dict] = {}): +def build_oauth_auth_url(state: Optional[str] = None, user_params: Optional[dict] = {}): """ Build the OAuth redirect url to GroupMe. state is optional -- it is usually in reference to the organization in question. If so, state should be set to the organization's `addition_url`. (see schema.sql for info) """ - base = "https://oauth.groupme.com/oauth/authorize?" + base = current_app.config["REDIRECT_URL"] params = {} - params["client_id"] = client_id if state: params["state"] = state params = params | user_params + urlencoded = urlencode(params) - print(base + urlencode(params)) - print(params) - return base + urlencode(params) + if urlencoded: + base += "&" + + return base + urlencoded def get_oauth_auth_url(state: None | str = None): return build_oauth_auth_url( - current_app.config["CLIENT_ID"], state ) def custom_get_oauth_auth(params): return build_oauth_auth_url( - current_app.config["CLIENT_ID"], None, params )