FROM CACHE - en_header

Rest API in Laravel APP and problem with tokens for rest api

Shopify Partner
2 0 1



We create app using the project on laravel:


We have settings page with options created via Polaris. It looks great. But when I click save I want send request to endpoint.


This is request to endpoint like here:


I see that exists middleware for verify active session:

So I need to send request with header Authorization Barer with token. But I have problem how I should provide for fetch request header with token?

I tried to like this script:


render() {
     const app = useAppBridge();
     getSessionToken(app).then(async (token) => {



but I see errors:


Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See for tips about how to debug and fix this problem.

but this script works:


function ExamplePage() {
     const app = useAppBridge();
     getSessionToken(app).then(async (token) => {

     return <div>Example Page</div>


How I should provide token to rest request?

Replies 0 (0)