Integration of Google AppEngine with a thick client

I want to make a multi-user client-server solution with a thick Java Swing client as an interface and Google AppEngine (Java one) as an internal one.

The problem is that GAE only provides web forms for logging in and out, so there is no easy way to use the functions of Google Accounts in a thick client.

Can you give some hints / tips / ideas on how to enable logging in and logging out using GAE?

+3
source share
3 answers

For client applications, there is a way to authenticate with Google accounts, but I don’t know if the token you receive can be returned to AppEngine. See: ClientLogin for installed applications

+2
source

Sorry, I can only indirectly answer you. You can log in to the app on appspot.com with a Google account. You just need to do everything in your browser, including storing some cookies and accessing multiple servers as they bounce you.

I did this project a couple of times for the dead and got a shell script that basically runs cURL to login. Perhaps you can extract from it what you need.

#!/bin/bash

my_app="set-this-to-my-app-id"
url="http://$my_app.appspot.com"
curl='curl --cookie-jar cookies'

if [ -z "$EMAIL" -o -z "$PASS" ]; then
    echo -n 'Email: '
    read EMAIL
    echo -n 'Pass: '
    read PASS
fi

rm -f cookies auth

echo 'Login'
$curl https://www.google.com/accounts/ClientLogin --output auth \
      -d "Email=$EMAIL" -d "Passwd=$PASS" \
      -d accountType=HOSTED_OR_GOOGLE     \
      -d source=$my_app                   \
      -d service=ah

. auth # XXX Be careful here. The output of the above
       # command happens to be Bash syntax too!
rm -f auth

echo 'Logging into app and getting cookie'
$curl "$url/_ah/login?continue=$url/console/&auth=$Auth"

echo
echo 'Example POST query'
$curl -X POST --cookie cookies "$url/some/path" -d 'foo=bar'

echo
rm -f cookies
+2
source

@Jason DeFontes, ClientLogin .

as an alternative approach with minimal effort, you can embed web forms (html) in your thick client, that is, use the java component that supports html rendering (for example, JEditorPanewith it installed HTMLEditorKit), and present this component inside your swing application - at least however, users would not need to switch between your application and browser in this way.

+1
source

Source: https://habr.com/ru/post/1722139/


All Articles