-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Class Not Found #8
Comments
What version of the package are you using? Since version 3 we separated the generic code from the Laravel specific code, which you can now find here: https://packagist.org/packages/vatsim/sso-laravel |
i am using this version of package Kindly Provide a sample of code |
Try following the documentation here https://packagist.org/packages/vatsim/sso-laravel.
In composer.json, you only need config/app.php: return [
// ...
'providers' => [
// ...
Vatsim\OAuthLaravel\OAuthServiceProvider::class,
],
'aliases' => [
// ...
'VatsimSSO' => Vatsim\OAuthLaravel\SSOFacade:class,
],
]; routes: Route::get('vatsim/login', 'VatsimController@login');
Route::get('vatsim/validate', 'VatsimController@validate'); app/Http/Controllers/VatsimController.php: namespace App\Http\Controllers;
use VatsimSSO, Session, Redirect;
class VatsimController extends Controller {
function login() {
$returnUrl = '...'; // this url should go to the validate method on your site
return VatsimSSO::login(
$returnUrl,
function($key, $secret, $url) {
Session::put('vatsimauth', compact('key', 'secret'));
return Redirect::to($url);
},
function($e) {
throw $e; // Do something with the exception
}
);
}
// add method for validating the response as well
// see https://github.com/bonroyage/vatsim-sso-laravel#validating-login
} |
Thanks my error resolve.. thank u your sample code is very helpful for me. :) |
@bonroyage hi Please need some help provide some configuration code. this is my code... vastim-sso.php file
return [
]; And Route:
and Controller, `function login() {
ScreenShot Attached. Errors |
Did you add your environment variables? From your screenshot it looks like you didn't add a key, your returnUrl is still set to |
For the environment config, please see the Laravel documentation: https://laravel.com/docs/5.3/configuration#environment-configuration So in the vatsim-sso.php config file, you'll see it refers to In your .env file you can write them like
Imagine your domain is example.com and you configured the two routes: Route::get('login', ['name' => 'vatsim.login', 'uses' => 'VatsimController@login']);
Route::get('validate', ['name' => 'vatsim.validate', 'uses' => 'VatsimController@validate']); Then for a user to login, they go to example.com/login. In the controller method, your return URL should be example.com/validate, which you can easily add by writing $session = Session::get('vatsimauth'); // this was set in the login method
return VatsimSSO::validate(
$session['key'],
$session['secret'],
Input::get('oauth_verifier'), // this is what VATSIM returns
function($user, $request) {
// At this point we can remove the session data.
Session::forget('vatsimauth');
/**
* this is where we log the user in on our own app, but note that
* this is very basic, as we have not checked if the user exists
* in our own database yet, so you might want to create the user first
*/
Auth::loginUsingId($user->id);
return Redirect::home();
},
function($error) {
throw $e; // Do something with the exception
}
); I also suggest you check out the forums where there are multiple pinned threads that explain how it works: https://forums.vatsim.net/viewforum.php?f=134 |
Class 'Vatsim\OAuth\OAuthServiceProvider' not found in laravel 5.3 how to add providers in config/app.php file.. kindly help me
The text was updated successfully, but these errors were encountered: