Skip to content

Commit d56d3da

Browse files
committed
Fix oauth...
1 parent 1224c00 commit d56d3da

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

oauth

src/lib/atproto/oauth.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { configureOAuth, createAuthorizationUrl, finalizeAuthorization, getSession, OAuthUserAgent, resolveFromIdentity } from '@atcute/oauth-browser-client';
22
import type { FetchHandlerObject } from '@atcute/client';
33
import type { At } from '@atcute/client/lexicons';
4-
import { useEventListener } from '@vueuse/core';
54

65
configureOAuth({
76
metadata: {
@@ -29,20 +28,12 @@ export class AtpOauthClient {
2928
// recommended to wait for the browser to persist local storage before proceeding
3029
await new Promise(resolve => setTimeout(resolve, 200));
3130

32-
const hashPromise = Promise.race([
33-
new Promise(resolve => useEventListener(window, 'message', event => {
34-
const hash = event.data as string;
35-
resolve(hash);
36-
})),
37-
new Promise(resolve => setTimeout(resolve, 180000)) // 3 minutes
38-
]);
39-
4031
// redirect the user to sign in and authorize the app
41-
window.open(authUrl, '_blank');
32+
window.open(authUrl, '_blank', 'noopener,noreferrer');
4233

4334
// TODO setup a redirect instead
44-
const hash = (await hashPromise) as string | undefined;
45-
if (!hash) throw new Error('Authentication timed out');
35+
const hash = prompt('Input the code that was displayed on the page');
36+
if (!hash) throw new Error('User cancelled authentication');
4637

4738
// `createAuthorizationUrl` asks for the server to redirect here with the
4839
// parameters assigned in the hash, not the search string.

0 commit comments

Comments
 (0)