OAuth Not Working With Laravel - laravel-5

i am trying to connect my magento 2.0 store from my laravel application, when i make OAuth call from laravel to my magento 2.0 store laravel throws an error Class 'OAuth' not found.
OAuth is installed on my system and code works perfectly out side laravel but when i place code inside of a Laravel controller it throws the error
following is my code of OAuth call that i am making from laravel
$oAuth = new OAuth($integratoinData->auth_data->consumer_key, $integratoinData->auth_data->consumer_secret, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_AUTHORIZATION);
$oAuth->setToken($integratoinData->auth_data->access_token, $integratoinData->auth_data->access_token_secret);
$oAuth->fetch($integrationCredentials['url']);
$responseInfo = $oAuth->getLastResponseInfo();
please help me thank you in advance

Try adding '\' when making instance of OAuth:
$oAuth = new \OAuth($integrato...

Related

getting No such PaymentMethod: 'tok_1IPAGM4unAps2Hiagy7H655b' error message when im trying to update laravel 5.8 to 7 with spark

when I am going to update Laravel 5.8 to 7 and update dependencies like cashier, Laravel/spark-Aurelius . it's complete update but after registration with subcription it's shows an error No such PaymentMethod: 'tok_1IPAGM4unAps2Hiagy7H655b' .
this comes back with an paymentMethod: tak_
but i get an exception like below
https://i.stack.imgur.com/tLhPe.png
tok_1IPAGM4unAps2Hiagy7H655b is a Token, not a Payment Method. If Laravel Cashier is expecting a Payment Method, you'll need to change your code to either:
Change your backend code to create a Payment Method by passing in the token ID to card[token] (see https://stripe.com/docs/api/payment_methods/create#create_payment_method-card)
Change your client-side code to create Payment Methods using the Stripe.js createPaymentMethod function instead of createToken. You can see the differences between the two here: https://stripe.com/docs/payments/payment-intents/migration-synchronous#elements-step-1

Route [x] not defined when using auth middleware

I am making a website with laravel but i am getting an error while using middleware auth. it says Route[x] not defined.
i am using laravel 5.8 please some one help me
The route you have written that has no named route so you need to specify name for that route like this
Route::get('x', function() {
//
})->name('x')->middleware('auth');
for more information you can check here https://laravel.com/docs/7.x/urls#urls-for-named-routes

django-rest-auth throws error with URL versioning

Using Django Rest Auth for authentication in my DRF based app. Issue is, the logout URL does not work when I add URL versioning.
Calling: /v1/rest-auth/logout/ (POST)
Throws error: TypeError: post() got an unexpected keyword argument 'version'
urls.py:
URL_VERSION = r'^(?P<version>v[1])'
url(f'{URL_VERSION}/rest-auth/', include('rest_auth.urls'))
Other end-points e.g. login via /v1/rest-auth/login/ works okay with and without the URL_VERSION.
What could I be missing?
This issue was fixed recently.
https://github.com/Tivix/django-rest-auth/pull/373
The new version will be on pypi very shortly. Please pull the master branch version for now if possible.

Auth0 Login ServiceProvider

I follow up this tutorial using Laravel 5.4 Creating your first Laravel app and adding authentication
But I can't retrieve Auth0 users, the registration works fine in my dashboard new users are created in Auth0 server, but not in my local database and also I can't dd(Auth0::getUser());
I get this error:
Class 'Auth0\Login\LoginServiceProvider' not found
I've added this
Auth0\Login\LoginServiceProvider::class
in my provider array and
'Auth0' => Auth0\Login\Facade\Auth0::class
in my aliases.
I did all steps on configuration from Auth0 docs: Auth0 PHP (Laravel) SDK
I'm out off option now!
Ok, figure it out now.
The error was coming from 'AppServiceProvider.php'
Just import those two classes in AppServiceProvider.php as:
use Auth0\Login\Contract\Auth0UserRepository as Auth0UserRepositoryContract;
use Auth0\Login\Repository\Auth0UserRepository as Auth0UserRepository;
And then your Register method should look like this:
public function register()
{
$this->app->bind( Auth0UserRepositoryContract::class, Auth0UserRepository::class );
$this->app->bind( Auth0UserRepositoryContract::class, Auth0UserRepository::class );
}
if you want to persist data in your database then Create your own Repository and update the bind method YourCustomerRepositoryContract::class, YourCustomerRepository::class
Just like that.
For more info about creating your own Repository
Auth0 PHP (Laravel) SDK Quickstarts: Login

STRAVA – OAUTH2 of laravel, error

After using STRAVA – OAUTH2 of laravel, I am getting following error. Could anyone help me on this
ErrorException in StravaController.php line 27:
Undefined property: App\Http\Controllers\Api\v1\StravaController::$app
This error occured when provided this line of code inside the function and before the Socialite method
$key = 'SocialiteProviders.config.strava';
$config = new \SocialiteProviders\Manager\Config('key', 'secret', 'callbackUri');
$this->app->instance($key, $config)
You have to create an strava library object called app with client id and client secret. Then you can call the instance.

Resources