Hi Jon,

Your understanding is correct. AppsForYourDomainClient obtains a token
behind the scenes and uses it for setting the Authentication header
for further requests. This needs to be captured in the documentation.

Regarding expired tokens, the client interface to GData server throws
a rather specific 'SessionExpiredException' for expired tokens. This
exception is handled as we unwind the call stack at the service level.
The exception handler renews your token to offer a seamless
experience:
http://code.google.com/p/gdata-java-client/source/browse/trunk/java/src/com/google/gdata/client/GoogleAuthTokenFactory.java?r=51#490

-Anirudh


On Jul 15, 8:59 pm, Jon Warbrick <[EMAIL PROTECTED]> wrote:
> The documentation for the Java provisioning API in Java 
> (athttp://code.google.com/apis/apps/gdata_provisioning_api_v2.0_referenc...)
> completely fail to mention authentication! Digging around in the
> supplied libraries (gdata-samples.java-1.20.0.java.zip, gdata-
> src.java-1.20.0.java.zip) I think I've worked out that something like
> the following should work:
>
> import sample.appsforyourdomain.AppsForYourDomainClient;
> import com.google.gdata.data.appsforyourdomain.provisioning.UserEntry;
> import java.util.Random;
>
> public class ProvisioningTest {
>
>   public static void main(String[] arg) throws Exception {
>
>       AppsForYourDomainClient client =
>         new AppsForYourDomainClient("adminEmail", "adminPassword",
> "domain");
>
>       String randomFactor =
>           Integer.toString(1000 + (new Random()).nextInt(9000));
>
>       // Create a new user.
>       String username = "SusanJones-" + randomFactor;
>       String givenName = "Susan";
>       String familyName = "Jones";
>       String password = "123$$abc";
>
>       UserEntry createdUserEntry =
>         client.createUser(username, givenName, familyName, password);
>
>      // etc., etc. ...
>
>   }
>
> }
>
> Behind the scenes, I'm assuming that AppsForYourDomainClient will
> convert the supplied username/password into an authentication token
> and then using this to authorise the user creation and any subsequent
> actions. Is that right?
>
> If so, what happens when the token expires? I'm aware that this will
> only happen after 24 hours or so, but I'm considering creating a web
> application that will create user accounts 'on demand'. Clearly I want
> to re-use the authentication token for as long as I can, but that does
> mean that something will have to take responsibility for recreate it
> when needed. I need to know if that 'something' is me!
>
> Jon.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Apps APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-apps-apis?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to