The documentation for the Java provisioning API in Java (at
http://code.google.com/apis/apps/gdata_provisioning_api_v2.0_reference_java.html)
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