Does twitter Java API like twitter4j work with statusnet? - java

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.

Related

How to Create REST API For Phone Number Authentication in Spring-Boot Project?

I have created some API's for login but am not sure about creating a login with a Username/Phone Number. Can someone help out with any tutorials or any sort of idea on how to create a REST API for phone number authentication on a Spring-Boot Project?.
I also require a suggestion on how to bring the third party login like We log in with a google account on most of the web applications
From what I've understood in your question you are concerned about security and you would like to implement something like an MFA for your users.
Since sending OTP codes is expensive (not really but let's assume you want something free) and requires to access external APIs to send the codes (with its own logic) what I can suggest to you is using something like a TOTP (Google Authenticator or Microsoft Authenticator).
Here is a good (and most important WORKING) guide I've followed some time ago:
https://medium.com/javarevisited/spring-boot-two-factor-authentication-78e00aa10176
With the right adjustments and improvements (or simplifications in case) the main logic will be perfect for your application of MFA.
For the login using for example google/facebook/SAML SSO and so on I can suggest you check on OAUTH2:
https://www.baeldung.com/sso-spring-security-oauth2
Hope it helps
Hi Ninja please read this example and seraching internet
https://dzone.com/articles/add-login-to-your-spring-boot-app-in-10-mins

How to get the viber api key and auth token of viber to call viber rest Api,

I am creating a rest Api in java using spring boot. In my application I want to integrate Viber Api in my applicationin which i want to send messages and make voice call using viber api. In viber api docsI am unable to get any information how to generate the api key and auth token or how to create the viber public account.
can you please suggest me the steps or any working example code how to achieve the above requirements.
The document has clearly mentioned how to get authentication token. You have to store this token somewhere in properties file & use the same each time you make an api call.
If you get an error from viber, read the error code documentation to know what wrong you have done. Go through there official documentation in detail.
If you don't know how to make an API call from Spring-boot, read more about rest-template.

Implementing custom oauth-provider?

I want to implement Oauth-provider in such a way.
I have one project in which i am accessing the rest apis. Now i want to create my own oauth-provider for every api to hit.I google alot but count not found anything from which i can start my implementation.
I found google code for auth-provider but i am not been able to make it run. Code url is
auth-provider from google code.
In jsp once i say that create my oauth then i want to create oauth setting from my oauth-provider. So that i can get it and send it in header to test my api.
I also download IBM code but not getting how should i start.
IBM oauth 2.0 code
Please help me.
Thanks

Wish to create desktop app that combines facebook and email accounts all in one go - stuck at the first hurdle?

first poster :)
As the title says, I am looking to create a desktop app which will notify me of changes on facebook and new emails, and the facebook part (the first part I've tried) is baffling me. I've never worked with an api before, and have no idea how to integrate facebook's api with this desktop helper I want to create. I will be using java to create this desktop helper.
Thanks in advance!
Here are few pointers for you to get started. Please feel free to ask for clarifications and I will edit my answer accordingly:
For facebook, you can actually pull all those info via their API. There are a lot of types for API, but Facebook specifically use REST API over http.
To simplify, think of it as making an http call with specific parameters and you will be getting an output back.
In order to use facebook API you need to understand their protocol including authentication/login and how to request for things that you want. This would require some reading to their documentation which is pretty complete and available at http://developers.facebook.com/docs/.
For the description of their API URL and the input/output documentation, you could directly jump to Graph API Documentation http://developers.facebook.com/docs/reference/api/.
In order to call their API via HTTP from Java, you could leverage HttpClient library from Apache Http Components project http://hc.apache.org/. They have plenty of tutorial and examples for how to make http call using HttpClient
For combining with all other emails accounts (per your question), you need to deal with SMTP or IMAP (whichever email protocol that you are planning to combine with Facebook). This is already built-in to Java via their Java Mail API collection
You then can poll this data on interval basis to get an update from Facebook and your mails
Once you have figured out how to get the data, the rest is just following a good MVC framework. That means separating out your presentation, data and controller (application logic). Make sure that you are separating the classes for #1 and #2 and each of them put their data to normalized data format that then get feed to your View (presentation layer)

Can I run locally and debug a Web App that uses Google API's? [GWT+GAE]

I'm working on a web-app using Google App Engine with GWT, and I need to use Google API's (Google Calendar, Documents and so...).
As I know, I must configure a domain with Google to set my domain as callback of an OAuth Authentication. Am I right?
If so, am I forced to deploy on GAE to test? I mean, I can't run locally because my localhost can't be a valid callback.
Do you know any way to debug locally even using Google API's?
I have recommended to config a DynDNS, but isn't a solution in short term (incompatible router)...
If you use AuthSub instead I don't think you need to register a domain. The user just need a google account.
I have in the past used AuthSub together with Google Docs/Spreadsheet APIs on GAE and also been able to test it locally.
I can unfortunately not give you my code and exact solution (it was a while ago). But one of the samples I used extensively to base my code on was the FetcherServlet, check this code out:
http://code.google.com/p/google-app-engine-samples/source/browse/trunk/retrieving-gdata-feeds-java/src/com/google/appengine/demo/web/FetcherServlet.java?r=122
Also, I guess you might already have read this page (but their FetcherServlet uses OAuth, not AuthSub), so maybe just use it for some background info:
http://code.google.com/appengine/articles/java/retrieving_gdata_feeds.html

Categories