Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
myConsciousness committed Nov 19, 2024
1 parent 9798e58 commit 054faa7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 1 addition & 2 deletions packages/atproto_oauth/lib/src/oauth_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,7 @@ final class OAuthClient {

final body = jsonDecode(response.body);

if (response.statusCode == 401 &&
body['error'] == 'use_dpop_nonce' &&
if (body['error'] == 'use_dpop_nonce' &&
response.headers.containsKey('dpop-nonce')) {
session.$dPoPNonce = response.headers['dpop-nonce']!;

Expand Down
11 changes: 10 additions & 1 deletion packages/bluesky/example/example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import 'dart:io';

import 'package:atproto_core/atproto_core.dart';
import 'package:atproto_core/atproto_oauth.dart';
import 'package:bluesky/app_bsky_embed_video.dart';
import 'package:bluesky/atproto.dart';
Expand Down Expand Up @@ -180,8 +181,16 @@ Future<OAuthSession> get _oAuthSession async {
print(session.$publicKey);
print(session.$privateKey);

// You can restore OAuthSession from stored keys
final restoredSession = restoreOAuthSession(
accessToken: session.accessToken,
refreshToken: session.refreshToken,
publicKey: session.$publicKey,
privateKey: session.$privateKey,
);

// If you want to refresh session
// final refreshed = await oauth.refresh(bsky.oAuthSession!);

return session;
return restoredSession;
}

0 comments on commit 054faa7

Please sign in to comment.