Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

629
Views
Laravel URL facade temporarySignedRoute to external url

I'm using Laravel 8 to generate a temporary signed route and pass some params, but I'd like my URL to take me to some URL of my choosing rather than a page in my project.

For context, my Laravel 8 project is an API, so there are no views, my API is then consumed by a front-end project written in Nuxt.

I've tried adding my URL to the first arg of temporarySignedRoute but it says that my route isn't found.

$verifyURL = URL::temporarySignedRoute(
  'https://example.com/account/verify', Carbon::now()->addHours(24), ['contact' => 5, 'team' => 'john']
);

What am I missing or what workaround is there here?

UPDATE

So it turns out that I don't need to take the user to an external URL, but it seems that the wrong URL is being generated by URL::temporarySignedRoute.

The start of my generated URL is (for example) https://example.com/api/contact/verify and I need the URL to be https://api.example.com/api/contact/verify

So the same domain, except a sub-domain.

It looks like the APP_URL isn't being read because I changed it and it has no impact, and besides, this is used elsewhere, so I tried updating the URL with:

$verifyURL = URL::temporarySignedRoute(
  'contact.verify', Carbon::now()->addHours(24), ['contact' => 5, 'team' => 'john]
);

// fix for wrong URL
$verifyURL = str_replace('example.com', 'api.example.com', $verifyURL);

However, this appears to have an invalid signature when the link provided by $verifyURL is clicked? How can I get the api part at the beginning?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

URL::temporarySignedRoute() has a fourth parameter called $absolute which is a boolean. So if you want to prepend a custom url rather than the default url used by Laravel, this is the variable to change.

The default value for $absolute is true. Therefore in order to prepend your own custom url, be sure to change it to false first as below:

$verifyURL = URL::temporarySignedRoute(
  'contact.verify', Carbon::now()->addHours(24), ['contact' => 5, 'team' => 'john], false // The $absolute value
);

Then concatenate your custom url:

$your_custom_url . $verifyURL;
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!