forked from baron/baron-sso
활동상황 카드 '연동 해지' 액션 추가
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:http/http.dart' as http;
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'http_client.dart';
|
||||
import 'web_window.dart';
|
||||
import 'auth_token_store.dart';
|
||||
|
||||
class AuthProxyService {
|
||||
static String _envOrDefault(String key, String fallback) {
|
||||
@@ -596,11 +597,21 @@ class AuthProxyService {
|
||||
|
||||
static Future<List<dynamic>> fetchLinkedRps() async {
|
||||
final url = Uri.parse('$_baseUrl/api/v1/user/rp/linked');
|
||||
final client = createHttpClient(withCredentials: true);
|
||||
final useCookie = AuthTokenStore.usesCookie();
|
||||
final token = AuthTokenStore.getToken();
|
||||
|
||||
final client = createHttpClient(withCredentials: useCookie);
|
||||
final headers = <String, String>{
|
||||
'Content-Type': 'application/json',
|
||||
};
|
||||
if (!useCookie && token != null) {
|
||||
headers['Authorization'] = 'Bearer $token';
|
||||
}
|
||||
|
||||
try {
|
||||
final response = await client.get(
|
||||
url,
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
headers: headers,
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
@@ -616,11 +627,21 @@ class AuthProxyService {
|
||||
|
||||
static Future<void> revokeLinkedRp(String clientId) async {
|
||||
final url = Uri.parse('$_baseUrl/api/v1/user/rp/linked/$clientId');
|
||||
final client = createHttpClient(withCredentials: true);
|
||||
final useCookie = AuthTokenStore.usesCookie();
|
||||
final token = AuthTokenStore.getToken();
|
||||
|
||||
final client = createHttpClient(withCredentials: useCookie);
|
||||
final headers = <String, String>{
|
||||
'Content-Type': 'application/json',
|
||||
};
|
||||
if (!useCookie && token != null) {
|
||||
headers['Authorization'] = 'Bearer $token';
|
||||
}
|
||||
|
||||
try {
|
||||
final response = await client.delete(
|
||||
url,
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
headers: headers,
|
||||
);
|
||||
|
||||
if (response.statusCode != 200) {
|
||||
|
||||
Reference in New Issue
Block a user