In laravel 10 using passport , Login Get Erro - authentication

TypeError: Cannot access offset of type string on string in file
D:\kr_dev\Projects\lara10\vendor\laravel\framework\src\Illuminate\Auth\AuthManager.php
on line 89
config(['auth.guards.superusers-api' => 'superusers']);
Auth::guard('superusers-api')->login($user,true);
or
config(['auth.guards.superusers-api' => 'superusers']);
Auth::guard('superusers-api')->attempt(['email' => $dto->email, 'password' => $dto->password], true);
also not working
how i make succesfull login

Related

Getting the "The provided value for the 'redirect_uri' is not valid" error when I try to get the access token

When I try to get the token I get the error:
The provided value for the 'redirect_uri' is not valid. The value must exactly match the redirect URI used to obtain the authorization code.
My redirect uri exactly matches so I don't understand why it is happening.
$TOKEN_ENDPOINT = 'https://login.microsoftonline.com/common/oauth2/v2.0/token';
$params = array(
'grant_type' => 'authorization_code',
'code' => $azureCode,
'clientId' => '7c09ab71-***-****-****-53d7c4438112',
'clientSecret' => 'bnot*******20*[',
'redirect_uri' => 'https://testing.****.com/outlookOauthCallback.php',
'urlAuthorize' => $AUTHORIZATION_ENDPOINT,
'urlAccessToken' => $TOKEN_ENDPOINT,
'urlResourceOwnerDetails' => '',
'scope' => 'Calendars.ReadWrite User.Read'
);
$response = $client->getAccessToken($TOKEN_ENDPOINT, 'authorization_code', $params);
(Trust me the part I turned into stars is exactly the same because I copy pasted)
Even in the response where I returned the params it is exactly the same:
Array
(
[grant_type] => authorization_code
[code] => M51b1b*****-daeec54627b2
[clientId] => 7c09ab71-a*****d7c4438112
[clientSecret] => bnotxds&*&QB***cVLF20*[
[redirect_uri] => https://testing.****.com/outlookOauthCallback.php
[urlAuthorize] => https://login.microsoftonline.com/common/oauth2/v2.0/authorize
[urlAccessToken] => https://login.microsoftonline.com/common/oauth2/v2.0/token
[urlResourceOwnerDetails] =>
[scope] => Calendars.ReadWrite User.Read
)
So how can it still be giving me this error? What am I missing here?
You need specify the redirect_uri in the request url. Something like
var href = 'login.microsoftonline.com/common/oauth2/…'; href += client_id + '&resource=webdir.online.lync.com&redirect_uri=' + window.location.href;

Getting Login Issue for New User with CoSign SOAP API

I have created the new user on the CoSign server. I am getting the following response (User password expired) while logging using the ValidateCredentials method.
Array
(
[Success] =>
[ErrData] => Array
(
[Message] => User password expired.
[Module] => ValidateCredentials
[Code] => -36
[InnerCode] => -1878916637
)
)
Can anybody help?
This error means that the user’s password has expired, and you need to reset it

Laravel 5 db:seed the username and password, but not authenticating on login

I have implemented Database seeder to seed in user (default) credentials.
Admin::create(['name' => 'Super Admin', 'email' => 'admin#demo.in', 'password' => bcrypt('password') ]);
After running seed, I got success message. But when I try to make login, it says your credential are not matching. Is there any particular reason for this. Can't we seed user data with bcrypt??
If we talk about the default AuthController of Laravel 5 obviously no you can't:
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}
If you have a look at the create() function you can see that the data submitted as password is automatically bcrypted. So if you bcrypt the password too it is bcrypted a second time.
Alright, some key points :
If you're using the User model for seeding, make sure that you'r not
hashing the password twice that could happen if you have a mutator
set in your model for the password column.
Be aware of your saved passwords in the browser, prefer writing
explicitly your username and password (in this case).
Finally check if there is no typo in your username/email or password. (that was my case 🤦‍♂️)
I inserted the data into my user table from my seeder as so:
DB::table('users')->insert([
'Email' => 'admin#QualityBooks.co.nz',
'Name' => 'Administrator',
'PhoneNumber' => '00000',
'Password' => bcrypt('P#ssw0rd'),
'isEnabled' => true,
'isAdmin' => true
]);
This works for me and I am able to log in while using the default auth controller.

Shopify APP API

$shopify = shopify\client( $shop, $app_settings->api_key, $shop_data->access_token, false );
$products = $shopify('GET', '/admin/products.json', array('published_status' => 'published'));`
I am getting the following response by printing the $shopify:
Closure Object
(
[static] => Array
(
[base_uri] => https://4f4b14c3eb5464ae238dd6cf4b88bce6:c2608b7067c5bf96028876023114b68c#pilibaba.myshopify.com/
[oauth_token] => c2608b7067c5bf96028876023114b68c
[private_app] => 2f996f1bd2a0f4fb343703555c89a234
)
[parameter] => Array
(
[$method_uri] =>
[$query] =>
[$payload] =>
[&$response_headers] =>
[$request_headers] =>
[$curl_opts] =>
)
)
after that accessing the $product i am getting the following error.
Fatal error:
Uncaught phpish\shopify\CurlException: [3] malformed in /*****/shopify_app/shopify_app.php on line 36 thrown in /******/shopify_app/shopify.php on line 67
Is it a problem with my access token? as i do have all the store permission while installing the app.
I did research for this error by didnt find any help either from shopify support team.
change keys of your url:
apikey = c2608b7067c5bf96028876023114b68c
access_token = 4f4b14c3eb5464ae238dd6cf4b88bce6
https://c2608b7067c5bf96028876023114b68c:4f4b14c3eb5464ae238dd6cf4b88bce6#pilibaba.myshopify.com/admin/shop.json

Drupal 7 - how to allow an application to access a certain drupal url (from menu hook), either with super basic url-based auth or anonymously

I'm pretty new to drupal, so bear with me if I'm not using correct terms.
I'm trying to give a stupidly basic application access to a drupal url - this application cannot do any complicated authentication.
Otherwise, this drupal system needs authentication and all other menu hooks use 'access arguments' => array('access content')
Even before looking a solution for easy authentication method with drupal like http://user:password#server.com/awesome/member/12345, I've tried just giving anonymous access with the following code block in a drupal .module file
function awesome_module_menu() {
$items['awesome/member/%'] = array(
'title' => 'Awesome member',
'type' => MENU_NORMAL_ITEM,
'page callback' => 'aw_memberdata_fetch',
'delivery callback' => 'aw_memberdata_deliver',
'access arguments' => TRUE // this supposedly should allow anonymous access - from the web
);
return $items;
}
I have these two functions, one to fetch the data, one to show it:
function aw_memberdata_fetch(memberId)
{
//fetch array of objects from DB
...
return $items;
}
function aw_memberdata_deliver($items)
{
switch(arg(3)) //format, comes after items
{
case 'json':
drupal_json_output($items);
break;
default:
$output = makeHtml($items); //makes HTML
drupal_deliver_html_page($output);
}
}
With an authenticated browser, this works as intented. From a browser with no auth cookie I'm allowed to see the HTML, but the results are not there, it's like the page callback function doesn't run for anon users, but delivery callback does.
How do I make this work for anon users?
You are using access arguments with the default user_access function for permission verification. This will basically call user_access(true) which will return
true for authenticated user (you are probably testing with the administrator account (uid = 1)) which bypasses the verification check. Administrator has full privileges.
false for anonymous users because the string value of the first argument passed to the user_access true doesn't exist as a permission setting.
You should use either use
a custom YOURMODULE_access hook which does the permission verification
declare custom permissions for your module (YOURMODULE_permission hook)
don't use permission verification by using 'access callback' => true which gives access to anonymous and authenticated users
function awesome_module_menu() {
$items['awesome/member/%'] = array(
'title' => 'Awesome member',
'type' => MENU_NORMAL_ITEM,
'page callback' => 'aw_memberdata_fetch',
'delivery callback' => 'aw_memberdata_deliver',
'access callback' => true,
);
return $items;
}