Basic Requirements for accessing Gmail with Oauth2 3 legged - java

What are the basic requirements (library) to access gmail using Oauth2 3 legged?
Is there any java library supported for this access?
Any kickstart example using java?
I found the example from google, but it seem like using python script to get access token. And I am getting confused.
Any inputs will be helpful.

There are two high level steps to access the Gmail APIs using OAuth2:
Obtain a user access token. To accomplish this, read this guide first, it contains the basic steps. Then, checkout the Google OAuth2 Java client library, which has convenience classes that abstract away some of the low level protocol details.
Use the token to authenticate w/ Gmail IMAP/SMTP and start reading mails! You already found out the relevant library in your link included in the question.

Use the token to authenticate w/ Gmail IMAP/SMTP and start reading mails! You already found out the relevant library in your link included in the question.

Related

Authorization in google with using OAuth 2 without browser

Please tell me if there is some sample code that allows you to log in to Google Spreadsheets using Java and Google OAuth 2 without recourse to the browser?
I found them a code sample, but it is only for .NET
An overview of using OAuth2 with Java can be found here: https://developers.google.com/api-client-library/java/google-oauth-java-client/oauth2
You can learn more about using OAuth2 and Java to perform authentication and authorisation for Google services here:
https://developers.google.com/api-client-library/java/google-api-java-client/oauth2#overview
Both guides instruct the reader on how to use the OAuth2 API and include Java code samples.

How to implement OAuth in Bitrix for third party Applications?

I am currently using Bitrix24 for HR management and task management.
Since it provides an option to integrate third party applications with it, I am stuck in how to implement OAuth for my application with Bitrix.
I went through documentation provided by Bitrix24 but it uses php code.
Is there any sample JAVA code available for OAuth implementation?
Unfortunately havent seen any examples on other that PHP languages, but
if you are already experienced with Java it should not be a problem.
In case you are working with bitrix24 cloud edition - you need to
1) create application for marketplace using you partner account and obtain secret key and application id
2) send this secret key and application id from your application written on any language and receive
3) receive request token and refresh_token and use them to access rest api provided by Bitrix24 https://training.bitrix24.com/rest_help/
more details on what kind of request you need to do: https://training.bitrix24.com/rest_help/oauth/examles.php
hope this help you.
You can use API like this for JAVA
I am adding LEADS from the API, and updating the same LEAD
to add the LEAD:-
Method: POST
URL:-
https://.bitrix24.com/rest/crm.lead.add
Parameters:-
{"fields[TITLE]":"LEAD_TITLE","auth":"AUTH_TOKEN"}
It will add the new LEAD in you Bitrix Dashboard.

Java/Scala SAML client example needed

I'm writing some Scala code that will run on a server. It needs to periodically connect to Office 365 to pull some data using OData. I don't have access to AD to register an app. I'm using a username and password for authentication.
Are there any suitable Java or Scala libraries I can use for the authentication step? At the very least, I'd love to see some sample code in any language that shows the authentication step. (Please don't provide samples that use a .Net library for the authentication step. I need to be able to reproduce the logic in a JVM on Linux.)
There is an excellent example at https://github.com/onelogin/java-saml, which provides a class to prepare the request and a class to process the response. There are some things to fill in, but the wikipedia entry on SAML should be enough.

How to authenticate users from a rest service

I am trying to authenticate users with a REST service I built using drop wizard. From previous questions I found great example of authenticating with openID on github: https://github.com/gary-rowe/DropwizardOpenID
However, I don't want to deal with openID at the moment and simply want users to 1. Signup, 2. Signin
My questions/confusions are:
For Signup: I'm thinking about sending users's username/password as a POST request with the credentials as either form parameters or part of JSON body. However, isn't there a security risk here of sending password in plain text?
For Sing-in I'm thinking about using Authenticator in Dropwizard.
I don't want to store passwords in plain text. What strategy should I follow after I get the users' password in the POST as plain text? I'm looking for some java libraries that can assist in password salt and MD5
Thanks for the shout out for the Dropwizard OpenID project. Glad it was able to get you started.
If you want a pure web form type approach, take a look at another of my projects MultiBit Merchant which provides multiple authentication methods (web form, HMAC, cookie).
You'll need to dig around to really see it working since this project is not designed as a demo as such and is very much a work in progress.
After loading the project, look for WebFormClientAuthenticator which will get you in the right area.
The general principles involved with Dropwizard authentication are discussed in this blog article. Although it targets HMAC you can easily adapt it for web form or cookie using the source code referenced earlier.
It's all MIT license so just use it as you need.
Looking at the docs, we can see that Dropwizard supports a standalone OAuth2 implementation:
http://dropwizard.codahale.com/manual/auth/#oauth2
OAuth2 has several advantages, many of which can be read about here: OAuth 2.0: Benefits and use cases — why?
Things to note:
when dealing with authentication, you should always host over HTTPS to ensure transport encryption
Dropwizard claims their OAuth2 implementation isn't yet finalized, and may change in the future. As a fall back, they do support Basic auth as well, which when used over HTTPS would be still reasonably secure.
Implementing this does not involve using any third party "social" authentication services such as Google or Facebook.

Does twitter Java API like twitter4j work with statusnet?

I have tried to access my own statusnet with twitter4j, as I'm trying to build a special Client. Therefore I struggled through many trials. I want to access the statusnet with OAuth, which is provided by twitter4j. First I tried to login with twitter4j by loading statusnet appropriate properties from an own ".properties" file so that it fits the values needed by OAuth. As this didn't really worked well, I changed the custom values as streams and tokens of twitter4j into statusnet one's. This didn't work either as I still get an IllegalStateException thrown when I try to get the OAuth-RequestToken.
Has anybody got experience with writing a Client for Statusnet or another twitter-clone in use of a twitter Java API like twitter4j, especcially with OAuth?
I have it working with status.net (identi.ca) and basic auth - see https://github.com/pilhuhn/ZwitscherA/blob/master/src/de/bsd/zwitscher/account/LoginActivity.java#L124 and then
https://github.com/pilhuhn/ZwitscherA/blob/master/src/de/bsd/zwitscher/TwitterHelper.java#L232
Did you get a OAuth application id from status.net?
I have found a solution:
Use Signpost OAuth Api. This is the most simple way to instanciate a individual Oauth Application with individual provider URIs. You can see a example with Twitter here. Replace the Twitter URIs with your statusnet ones and have a try, works really fine and simple.

Categories