oauth2_client icon indicating copy to clipboard operation
oauth2_client copied to clipboard

fullscreen LoginView on Tablet

Open Abaddon-88 opened this issue 2 years ago • 3 comments

Hey,

I built the plugin into my Flutter project and everything works so far. I have the following problem on the Ipad.

After I have confirmed the alert, the LoginView opens. However, this does not take up the whole page but is similar to a popup

How do I get the login window to its full width / height on a tablet.

I could not find any information on adjusting the login view in the documentation

I use the OAuth2Client and the OAuth2Helper classes

Abaddon-88 avatar Dec 14 '21 16:12 Abaddon-88

getTokenWithAuthCodeFlow() (and the other flows) takes a BaseWebAuth optional parameter, so you can override the web auth class. If you look in browser_web_auth.dart, you see that the login window is defined like this:

final popupLogin = html.window.open(
        url,
        'oauth2_client::authenticateWindow',
        'menubar=no, status=no, scrollbars=no, menubar=no, width=1000, height=500');

You can implement your own BaseWebAith overriding authenticate() to your own logic.

gregertw avatar Dec 25 '21 08:12 gregertw

Thank you @gregertw for the suggestion, it would definitely be a viable solution. Anyway I was thinking that we could exploit the "opts" parameter of the authenticate method to pass custom arguments to the popup window, such as the desired width and height.

Do you think it would an useful addition?

okrad avatar Dec 29 '21 22:12 okrad

@okrad apologies, this one slipped. Yes, that would absolutely be a better approach. A similar challenge (need for opts but on scopes on refreshToken) is when you try to support AAD as it requires more granularity in the scopes when you first do OIDC and then need to request an access token to a specific resource. You can see how I did it https://github.com/gregertw/cognite_flutter_demo/blob/master/lib/providers/aad.dart

gregertw avatar Jan 29 '22 16:01 gregertw