omniphx / forrest

A Laravel library for Salesforce
https://omniphx.github.io/forrest/
MIT License
259 stars 120 forks source link

Allow route name for callback uri #331

Open benrowe-chuffed opened 1 year ago

benrowe-chuffed commented 1 year ago

Instead of providing a static callback URI in the config, it would be nice to calculate this value dynamically based on a route name:

So instead of:

'credentials' => [
        //Required:
        'callbackURI' => env('SALESFORCE_CALLBACK_URI'),
],

you could do this instead:

'credentials' => [
        //Required:
        'callbackRoute' => 'web.salesforce.callback',
],

Then in your routes you can register a route with this name.

Route::get(...)->name('web.salesforce.callback');

The advantage of this is being able to dynamically calculate the callback URI, instead of having to create new SALESFORCE_CALLBACK_URI values for every environment.