From 639d3ca8d304204b71ba8637113428a0398a1789 Mon Sep 17 00:00:00 2001 From: Satoshi Imai Date: Tue, 22 Oct 2024 14:50:38 +0900 Subject: [PATCH] Add mode parameter to getAuthorizationUrl --- lib/pokepay_sdk.dart | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/pokepay_sdk.dart b/lib/pokepay_sdk.dart index 9f72f6f..9a5ca64 100644 --- a/lib/pokepay_sdk.dart +++ b/lib/pokepay_sdk.dart @@ -339,16 +339,18 @@ class PokepayOAuthClient { return "https://www" + suffix + ".pokepay.jp"; } - String getAuthorizationUrl({String contact = ""}) { + String getAuthorizationUrl({String contact = "", String? mode}) { String base = getWebBaseURL(this.env) + - "/oauth/authorize?client_id=" + - this.clientId + - "&response_type=code"; - if (contact.length > 0) { - return base + "&contact=" + Uri.encodeFull(contact); - } else { - return base; + "/oauth/authorize?client_id=" + + this.clientId + + "&response_type=code"; + if (contact.isNotEmpty) { + base += "&contact=" + Uri.encodeFull(contact); + } + if (mode != null && (mode == "login" || mode == "register")) { + base += "&mode=" + Uri.encodeFull(mode); } + return base; } Future getAccessToken(String code) async {