omniphx / forrest

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

How to use the library? #270

Closed javier-ram closed 4 years ago

javier-ram commented 4 years ago

Hi,

As simple as this question reads... Some users are having the same problem. I have found this question here among the issues and on Stackoverflow, all of them unanswered.

I have tried: use Forrest; use Omniphx\Forrest\Providers\Laravel\Facades\Forrest; use Omniphx\Forrest;

I am using Laravel 6.18.

Could you please give me some guidance?

Thank you

omniphx commented 4 years ago

Hi @javier-gocubesoftware ,

Make sure you add these lines to your config/app.php

Omniphx\Forrest\Providers\Laravel\ForrestServiceProvider::class
'Forrest' => Omniphx\Forrest\Providers\Laravel\Facades\Forrest::class

Then you'll be able to reference Forrest automatically without any use... statements:

Route::get('/authenticate', function()
{
    Forrest::authenticate();
    return Redirect::to('/');
});

Be sure to also follow the configuration/connected app steps: https://github.com/omniphx/forrest#configuration

javier-ram commented 4 years ago

Thank you Matt. I thought that was only for Laravel < 5.5.

Some tips for other users: 1- Set bootstrap/cache permissions to 777. 2- (It is stated on ReadMe like 20 times but important to remind)If using UserPassword auth, remember to append the security token to your password (https://trailblazers.salesforce.com/answers?id=90630000000glADAAY).

I am going to close this issue.

Great library @omniphx, very helpful. Thank you for your contribution.