Fix web build
This commit is contained in:
parent
172ed1e2cd
commit
de87ec17d1
9 changed files with 88 additions and 56 deletions
19
src/platform/auth-flow.ts
Normal file
19
src/platform/auth-flow.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import * as auth from '@adxp/auth'
|
||||
import * as ucan from 'ucans'
|
||||
import {makeAppUrl} from '../platform/urls'
|
||||
import {ReactNativeStore} from '../state/auth'
|
||||
import * as env from '../env'
|
||||
|
||||
export async function requestAppUcan(
|
||||
authStore: ReactNativeStore,
|
||||
scope: ucan.Capability,
|
||||
) {
|
||||
const did = await authStore.getDid()
|
||||
const returnUrl = makeAppUrl()
|
||||
const fragment = auth.requestAppUcanHashFragment(did, scope, returnUrl)
|
||||
const url = `${env.AUTH_LOBBY}#${fragment}`
|
||||
|
||||
// @ts-ignore window is defined -prf
|
||||
window.location.href = url
|
||||
return false
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue