From 0f040d2d368c5183ee20b577c0d29159747317bd Mon Sep 17 00:00:00 2001 From: igorwork <markin.io210@gmail.com> Date: Sat, 20 Jul 2019 10:58:11 +0300 Subject: [PATCH] Move creds to config --- lib/config.dart | 10 +++++++++- lib/screens/home.dart | 15 ++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/config.dart b/lib/config.dart index ccf766c..b155306 100644 --- a/lib/config.dart +++ b/lib/config.dart @@ -1 +1,9 @@ -const String APP_HOST = "https://demo1.vereign.com"; \ No newline at end of file +const String APP_HOST = "https://demo1.vereign.com"; + +/* OAuth */ +const String CLIENT_ID = "123123"; +const String CLIENT_SECRET = "123123"; + +const String REDIRECT_URL = "app://com.vereign.app/oauth2"; +const String AUTH_ENDPOINT = "$APP_HOST/api/oauth2/authorize"; +const String TOKEN_ENDPOINT = "$APP_HOST/api/oauth2/token"; \ No newline at end of file diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 1ad3333..84f69d1 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -17,13 +17,6 @@ class Home extends StatefulWidget { _HomeState createState() => _HomeState(); } -String clientId = "222222"; -String clientSecret = "22222222"; - -String redirectURL = "app://com.vereign.app/oauth2"; -String authEndpoint = "$APP_HOST/api/oauth2/authorize"; -String tokenEndpoint = "$APP_HOST/api/oauth2/token"; - class _HomeState extends State<Home> { @override initState() { @@ -90,13 +83,13 @@ class _HomeState extends State<Home> { startOAuth() { FlutterAppAuthWrapper.startAuth( AuthConfig( - clientId: clientId, - clientSecret: clientSecret, - redirectUrl: redirectURL, + clientId: CLIENT_ID, + clientSecret: CLIENT_SECRET, + redirectUrl: REDIRECT_URL, state: "login", prompt: "consent", endpoint: AuthEndpoint( - auth: authEndpoint, token: tokenEndpoint), + auth: AUTH_ENDPOINT, token: TOKEN_ENDPOINT), scopes: [ "user_account_status", "user_territory", -- GitLab