0

I do the following in a java application to authenticate my client and multi-client.

  AppsForYourDomainClient client = null;
  ProvisioningApiMultiDomainSampleClient multiClient = null;
  try {
     client = new AppsForYourDomainClient("[email protected]", "password", "email.com");

     multiClient = new ProvisioningApiMultiDomainSampleClient("[email protected]", "password", "email.com","multidomain-api-sample-email.com");

  } catch (Exception ex) {
        ex.printStackTrace();   
  }  

I want to switch to OAuth 2 authentication. Also AppsForYourDomainClient and ProvisioningApiMultiDomainSampleClient are being deprecated. How do I move forward with authenticating with OAuth2 and the new Google Directory API?

What I was needing was examples. There seems to be plenty of documentation but very little example.

Luckily I found this: Create gmail account for a domain using Google Admin SDK Directory API in Java

Which points me in the right direction. And I hope if this post comes up on any searches, then they can refer to the link above.

Thanks

3
  • The obvious answer is read the docs. There are no real shortcuts. For example, your question doesn't state whether your Java app is on Android, installed on a PC, or running in a web service. The OAuth answer would be different for each scenario. You should also know that OAuth is not an authentication protocol, it's an authorization protocol. Sorry if it's not the answer you're looking for, but I'd be doing you a disservice to mislead you into thinking you can implement OAuth without fundamentally understanding it first. Start with developers.google.com/identity/protocols/OAuth2 Commented Apr 8, 2015 at 12:03
  • Thank you. I'm reading and understanding more but examples help far beyond reading. I have found one that points me in the right direction and I edited my post to reflect that. Commented Apr 8, 2015 at 13:57
  • Be really careful. OAuth has so many variants, and is so misunderstood, that you can waste a lot of time chasing examples that turn out to be red herrings. Been there, seen it, got the t-shirt. The link I posted (with it's child links for the different scenarios) and the Oauth Playground are your best friends. Commented Apr 8, 2015 at 14:27

1 Answer 1

0

Check if this link helps - https://developers.google.com/identity/protocols/OAuth2WebServer

There are a number of steps that need to be followed. You will first need to create a project in Google Developer Console and go from there.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.