Skip to content

Commit

Permalink
touch ups
Browse files Browse the repository at this point in the history
  • Loading branch information
gwbischof committed Dec 22, 2024
1 parent aa8e6e9 commit f46f715
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/core/auth/bloc/auth_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -250,16 +250,15 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {

// Extract the code from the response.
String code = Uri.parse(providerResponse.uri.toString()).queryParameters['code'] ?? "failed";
debugPrint("CODE");
debugPrint(code);
debugPrint("CODE $code");

if (code == "failed") {
throw Exception("OAuth login failed: no code received from provider.");
}

// TODO: This should use lemmy_api_client.
// Authenthicate to lemmy and get a jwt.
// Durring this step lemmy with connect to the Provider to get the user info.
// Durring this step lemmy connects to the Provider to get the user info.
final response = await http.post(Uri.parse('https://$instance/api/v3/oauth/authenticate'),
headers: {
'Content-Type': 'application/json',
Expand All @@ -271,10 +270,11 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
}),
encoding: Encoding.getByName('utf-8'));

// TODO: Need to add a step to set the account username.

final accessToken = jsonDecode(response.body)['jwt'] as String;

debugPrint("JWT");
debugPrint(accessToken);
debugPrint("JWT $accessToken");

GetSiteResponse getSiteResponse = await lemmy.run(GetSite(auth: accessToken));

Expand Down

0 comments on commit f46f715

Please sign in to comment.