Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 791433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:50:07+00:00 2026-05-14T21:50:07+00:00

implementing service something similar with tinyurl or bit.ly, I’m would like to expose service

  • 0

implementing service something similar with tinyurl or bit.ly, I’m would like to expose service as API, I’m using java and jersey as RESTfull service implementation.

I’m looking for simplest way for authentification of users who use API, OAuth is first thing coming in mind, but the problem is I don’t need this 3 iteration calls with request token query, than access token query with callback url passing. I just need to give user ability to invoke api with no additional security calls to my server.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:50:09+00:00Added an answer on May 14, 2026 at 9:50 pm

    Thanks to patrickmcgraw comment I used 2-legged oauth authentificaton.
    Here is some java code.

    For client side (using Jersey api):

    OAuthParameters params = new OAuthParameters().signatureMethod("HMAC-SHA1").
        consumerKey("consumerKey").version("1.1");
    
    OAuthSecrets secrets = new OAuthSecrets().consumerSecret("secretKey");
    OAuthClientFilter filter = new OAuthClientFilter(client().getProviders(), params, secrets);
    
    
    WebResource webResource = resource();
    webResource.addFilter(filter);
    
    String responseMsg = webResource.path("oauth").get(String.class);
    

    On provider side:

    @Path("oauth")
    public class OAuthService {
        @GET
        @Produces("text/html")
        public String secretService(@Context HttpContext httpContext) {
            OAuthServerRequest request = new OAuthServerRequest(httpContext.getRequest());
    
            OAuthParameters params = new OAuthParameters();
            params.readRequest(request);
            OAuthSecrets secrets = new OAuthSecrets().consumerSecret("secretKey");
    
            try {
                if(!OAuthSignature.verify(request, params, secrets)) 
                    return "false";
            } catch (OAuthSignatureException ose) {
                return "false";
            }
    
            return "OK";
        }
    }
    

    Here is code for PHP client:

    <?php 
    
    require_once 'oauth.php';
    
    $key = 'consumerKey';
    $secret = 'secretKey';
    $consumer = new OAuthConsumer($key, $secret);
    
    $api_endpoint = 'http://localhost:9998/oauth';
    $sig_method = new OAuthSignatureMethod_HMAC_SHA1;
    
    $parameters = null;
    $req = OAuthRequest::from_consumer_and_token($consumer, null, "GET", $api_endpoint, $parameters);
    $sig_method = new OAuthSignatureMethod_HMAC_SHA1();
    $req->sign_request($sig_method, $consumer, null);//note: double entry of token
    
    //get data using signed url
    $ch = curl_init($req->to_url());
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $res = curl_exec($ch);
    
    echo $res;
    curl_close($ch);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm implementing an app for a micro blog service, something similar to twitter. I've
I am exploring the idea of implementing a web service api using WCF Data
I'm currently implementing a REST web service using CouchDB and RESTlet. The RESTlet layer
I am implementing a push notification service. I would need to create a database
I'm facing a bit of difficulties implementing the HA for my ActiveMQ service. Right
I am looking at implementing a Web Service API for our product. I have
I tried implementing a simple web service into an asp.net application using the tutorial
I'm currently using Casbah with MongoDB for implementing web service. I am having no
I'm implementing a method that does something like: ... try { myPojo.setProperty(foo); myService.execute(myPojo); }
I'm implementing a Web service that returns a JSON-encoded payload. If the service call

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.