Pretty sure every target platform has a “WebView” of some kind to do this, no problems on mobile.
Certainly with a Full-Screen Windows app it would be possible to use a WebView without changing resolution or needing to minimize.
Although the popup authentication windows that Facebook, Google, etc create might look a bit odd depending on resolution.
The devil is in the details.
You could always simply mimic the requests that a browser would make.
You can complete this yourself on the command line using CURL.
The following assumes:
- Your Discourse instance is at
https://try.example.com
- Username is
ExampleUser1
- Password is
ExamplePasswordXX!
1. Initially make a request to get both _forum_session
cookie and CSRF-Token
curl -v "https://try.example.com/session/csrf" -H "X-CSRF-Token: undefined" -H "Referer: https://try.example.com/" -H "X-Requested-With: XMLHttpRequest"
2. Note the _forum_session
cookie value from header and csrf
JSON result in body
< Set-Cookie: _forum_session=XXXXXXXXXYYYYYYYYZZZZZZ; path=/; HttpOnly; Secure
{"csrf":"XXXXXXXXaaaaaaaaaaaaXXXXXXXXXXXXXX=="}
3. Attempt a login request
curl -v "https://try.example.com/session" -H "Origin: https://try.example.com" -H "X-CSRF-Token: XXXXXXXXaaaaaaaaaaaaXXXXXXXXXXXXXX==" -H "Cookie: _forum_session=XXXXXXXXXYYYYYYYYZZZZZZ" -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -H "Referer: https://try.example.com/" -H "X-Requested-With: XMLHttpRequest" --data "login=ExampleUser1&password=ExamplePasswordXX!"
4. Read the response
Expect a JSON response back containing the users basic profile info.