How to get an instance of AuthenticationService in BAP?

In our BAP application we direct the user to paypal. After returning from paypal there should be no login if it isn’t required. So the idea is to get api/user/data to see if the user is still authenticated. But there are currently no actionsavailable to do just this as far as I could see. That’s why I wanted to use AuthenticationService.user (defined in @com.mgmtp.a12/user-api/lib/Authentication.service) to achieve this. But I don’t know how I can access the instance of AuthenticationService in my middleware.

EDIT:
I just found out that there exists PlatformServerConnectors.restoreAuthenticationState, but I don’t know how this should be used.

Hi. I see that at the step of application start-up, we could use the PlatfromServerConnectors.restoreAuthenticationState before the application gets rendered.

In appsetup.ts

export function setup(): {
    ...
	initialStoreActions(): Promise<void>;
} {
	return {
        ...,
		initialStoreActions: async () =>  {
			return platformServerConnectors.restoreAuthenticationState(config.store.dispatch);
		}
	};
}

In index.tsx

const {
    ...
	initialStoreActions
} = setup();

initialStoreActions().then(() => {
	ReactDOM.render(
		...
	);
});

Hope you can have an idea how PlatfromServerConnectors.restoreAuthenticationState can be used and find a way to use in your app.