Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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

share|improve this question
    
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 –  pinoyyid Apr 8 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. –  GGROD Apr 8 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. –  pinoyyid Apr 8 at 14:27

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.