Fix, add user agent to OAuth flow network calls.

merge-requests/67/merge
Hank Grabowski 2024-12-20 12:48:44 -05:00
rodzic f623d4bf31
commit 039038dca7
1 zmienionych plików z 10 dodań i 7 usunięć

Wyświetl plik

@ -111,6 +111,7 @@ class OAuthCredentials implements ICredentials {
final idEndpoint = Uri.parse('https://$serverName/api/v1/apps');
final request = NetworkRequest(idEndpoint,
headers: ref.read(userAgentHeaderProvider),
body: {
'client_name': 'Relatica',
'redirect_uris': redirectUrl,
@ -180,13 +181,15 @@ class OAuthCredentials implements ICredentials {
);
}
final url2 = Uri.parse('https://$serverName/oauth/token');
final request = NetworkRequest(url2, body: {
'client_id': clientId,
'client_secret': clientSecret,
'redirect_uri': redirectUrl,
'grant_type': 'authorization_code',
'code': code,
});
final request = NetworkRequest(url2,
headers: ref.read(userAgentHeaderProvider),
body: {
'client_id': clientId,
'client_secret': clientSecret,
'redirect_uri': redirectUrl,
'grant_type': 'authorization_code',
'code': code,
});
final response = await ref.read(httpPostProvider(request).future);
response.match(onSuccess: (body) {
ref