Closed paradyo closed 2 years ago
It seems like you haven't configured the dynamic-links domain in https://github.com/kreait/laravel-firebase/blob/main/config/firebase.php#L102 (either directly in the config file or via environment variable).
You need to configure the dynamic-links domain with your https://vienot.page.link/
and use the URL call the createDynamicLink
method with the URL you want to shorten.
In your .env file:
FIREBASE_DYNAMIC_LINKS_DEFAULT_DOMAIN=https://vienot.page.link/
In your code:
$url = 'https://the.url/you/want-to-shorten';
try {
$dynamicLinkInstance = Firebase::dynamicLinks()->createDynamicLink($url);
} catch (CreateDynamicLink\FailedToCreateDynamicLink $e) {
echo $e->getMessage(); exit;
}
Oh, it looks great but the problem is still going.
Invalid Dynamic Link domain: '' or Domain Uri Prefix: 'https://vienot.page.link/'. Expecting exactly one. Dynamic Link Domain isPresent = false, Domain URI prefix isPresent = false, [https://firebase.google.com/docs/dynamic-links/rest#create_a_short_link_from_parameters]
I've added .env file like you provided.
Here is the code:
`
$url = 'https://vienot.app/12342';
Firebase::project('app')->auth();
$dynamicLinkInstance = Firebase::dynamicLinks();
try {
$link = $dynamicLinkInstance->createDynamicLink($url);
} catch (CreateDynamicLink\FailedToCreateDynamicLink $e) {
echo $e->getMessage(); exit;
}
`
EDIT: I just solved. In .env file i removed the last '/' char. And now I get the expected DynamicLink object. Thanks.
Glad it worked out!
Hey,
Here is my code. `
` Here is the error:
Invalid Dynamic Link domain: '' or Domain Uri Prefix: ''. Expecting exactly one. Dynamic Link Domain isPresent = false, Domain URI prefix isPresent = false, [https://firebase.google.com/docs/dynamic-links/rest#create_a_short_link_from_parameters]
I dont have any idea. I can use cloud messaging easily but can not use dynamic links.
Everything ready at my Firebase panel by the way.
Is there any example code?