Closed Anjali-Maru closed 2 years ago
1-You have replace the @sessionToken with @csrf if you use post method ! 2-You have need to add following code after
. ` @if(\Osiset\ShopifyApp\Util::getShopifyConfig('appbridge_enabled'))<script nonce="{{ csp_nonce() }}" src="https://unpkg.com/@shopify/app-bridge-utils{{ \Osiset\ShopifyApp\Util::getShopifyConfig('appbridge_version') ? '@'.config('shopify-app.appbridge_version') : '' }}"></script>
<script nonce="{{ csp_nonce() }}"
@if(\Osiset\ShopifyApp\Util::getShopifyConfig('turbo_enabled'))
data-turbolinks-eval="false"
@endif
>
var AppBridge = window['app-bridge'];
var actions = AppBridge.actions;
var utils = window['app-bridge-utils'];
var createApp = AppBridge.default;
var app = createApp({
apiKey: "{{ \Osiset\ShopifyApp\Util::getShopifyConfig('api_key', $shopDomain ?? Auth::user()->name ) }}",
shopOrigin: "{{ $shopDomain ?? Auth::user()->name }}",
host: "{{ \Request::get('host') }}",
forceRedirect: true,
});
</script>
@include('shopify-app::partials.token_handler')
@include('shopify-app::partials.flash_messages')
@endif ` 3- You can't use Auth::user when you sends the ajax request, for this you have need to get Auth::user id through jquery or javascript. Then pass its value in laravel method ! I mean in this 17 package, when we send request through ajax, then we cant use direct the auth::user value in controller, for this we have need to get its value thorugh blade file to ajax request thewn get in to contoller ! Do follow these steps, i hope you will able to solve your issue Thank You
@haseebtanveerbutt has explain a solution so going to close this ticket.
I want to delete the user data from the use of Ajax so that the user grid is not reloaded. But in this, I get only one error return is session token is invalid when I have passed the route in ajax URL. How can I solve this?
Expected Behavior
User data should be deleted from the database
Current Behavior
{"error":"Session token is invalid."}
Version