hey i’m trying to creating an custom app using laravel but here when i try to get the access token im always getting the online access token
public function redirecturl(Request $request){
$apikey = "api key";
$apisecret = “api secret”;
$redirect_url=“using ngrok redirect url”;
$shop = $request->get(‘shop’); // shop domain
$code = $request->get(‘code’); // Shopify code
// 1. Exchange code for access token
$getaccestoken = Http::post(“https://{$shop}/admin/oauth/access_token”, [
‘client_id’ => $apikey,
‘client_secret’ => $apisecret,
‘code’ => $code,
\]);
// dd($getaccestoken);
$data = $getaccestoken->json();
dd($data);
$access_token = $data[‘access_token’];
if (!$accessToken) {
return response(‘Access token not received’, 500);
}
// 2. Save in database
Shopsdata::updateOrInsert(
\['shop_name' => $shop\],
\['access_token' => $access_token\]
);
return “App installed successfully!”;
}