[WBX-281] - 2049 Hardcoded URL in Create Application Success Dialog (#2053)

* Use NUXT_PUBLIC_BASE_URL to build application URL

* Use URL constructor for auth link

* Revert "Use URL constructor for auth link"

This reverts commit 8a84fdb2c850e0a0698ac06337b355074aa07da1.

* Build url using URL(...).toString()
This commit is contained in:
andrewwallacespeckle
2024-02-20 11:28:12 +00:00
committed by GitHub
parent 0cb817986b
commit 3a25277c2c
@@ -28,11 +28,7 @@
<strong>Note:</strong>
To authenticate users inside your app, direct them to
</p>
<CommonClipboardInputWithToast
v-if="props.application?.secret"
:value="`https://latest.speckle.dev/authn/verify/${props.application?.id}/{code_challenge}`"
is-multiline
/>
<CommonClipboardInputWithToast v-if="authUrl" :value="authUrl" is-multiline />
<p>
`{code_challenge}` is an OAuth2 plain code challenge that your app needs to
generate for each authentication request.
@@ -54,6 +50,21 @@ const props = defineProps<{
const isOpen = defineModel<boolean>('open', { required: true })
const {
public: { baseUrl }
} = useRuntimeConfig()
const authUrl = computed(() => {
if (props.application?.id) {
const url = new URL(`/authn/verify/${props.application.id}`, baseUrl)
const finalUrl = `${url.toString()}/{code_challenge}`
return finalUrl
}
return null
})
const dialogButtons = computed(() => [
{
text: 'Close',