few small changes
This commit is contained in:
@@ -12,9 +12,9 @@ import IsomorphicOAuthServerMetadataResolver from '@atproto/oauth-server-metadat
|
|||||||
|
|
||||||
import {CryptoSubtle} from './crypto-subtle'
|
import {CryptoSubtle} from './crypto-subtle'
|
||||||
import {
|
import {
|
||||||
BrowserOAuthDatabase,
|
|
||||||
DatabaseStore,
|
DatabaseStore,
|
||||||
PopupStateData,
|
PopupStateData,
|
||||||
|
RNOAuthDatabase,
|
||||||
} from './rn-oauth-database'
|
} from './rn-oauth-database'
|
||||||
|
|
||||||
export type BrowserOauthClientFactoryOptions = {
|
export type BrowserOauthClientFactoryOptions = {
|
||||||
@@ -39,7 +39,7 @@ export class RNOAuthClientFactory extends OAuthClientFactory {
|
|||||||
crypto = globalThis.crypto,
|
crypto = globalThis.crypto,
|
||||||
fetch = globalThis.fetch,
|
fetch = globalThis.fetch,
|
||||||
}: BrowserOauthClientFactoryOptions) {
|
}: BrowserOauthClientFactoryOptions) {
|
||||||
const database = new BrowserOAuthDatabase()
|
const database = new RNOAuthDatabase()
|
||||||
|
|
||||||
super({
|
super({
|
||||||
clientMetadata,
|
clientMetadata,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import * as Browser from 'expo-web-browser'
|
import * as Browser from 'expo-web-browser'
|
||||||
import {BrowserOAuthClientFactory} from '@atproto/oauth-client-react-native'
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
buildOAuthUrl,
|
buildOAuthUrl,
|
||||||
@@ -12,11 +11,12 @@ import {
|
|||||||
OAUTH_RESPONSE_TYPES,
|
OAUTH_RESPONSE_TYPES,
|
||||||
OAUTH_SCOPE,
|
OAUTH_SCOPE,
|
||||||
} from 'lib/oauth'
|
} from 'lib/oauth'
|
||||||
|
import {RNOAuthClientFactory} from '../../../../modules/expo-bluesky-oauth-client'
|
||||||
|
|
||||||
// Service URL here is just a placeholder, this isn't how it will actually work
|
// Service URL here is just a placeholder, this isn't how it will actually work
|
||||||
export function useLogin(serviceUrl: string | undefined) {
|
export function useLogin(serviceUrl: string | undefined) {
|
||||||
const openAuthSession = React.useCallback(async () => {
|
const openAuthSession = React.useCallback(async () => {
|
||||||
const oauthFactory = new BrowserOAuthClientFactory({
|
const oauthFactory = new RNOAuthClientFactory({
|
||||||
clientMetadata: {
|
clientMetadata: {
|
||||||
client_id: OAUTH_CLIENT_ID,
|
client_id: OAUTH_CLIENT_ID,
|
||||||
redirect_uris: [OAUTH_REDIRECT_URI],
|
redirect_uris: [OAUTH_REDIRECT_URI],
|
||||||
@@ -28,7 +28,7 @@ export function useLogin(serviceUrl: string | undefined) {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
await oauthFactory.signIn('afepwasfojefpaowejfpwef')
|
await oauthFactory.signIn('alice.test')
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user