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

What are some ideas (using .NET and SQL 2005) for implementing a service that
I'm implementing a email newsletter sender service using .NET and Windows Server technologies. Are
I have been studying SOAP and WSDL in preparation for implementing a web service.
We are implementing an IP based geolocation service, and we need to find some
I am looking for any strategies people use when implementing server applications that service
I am implementing web services for a PHP application and am trying to understand
I am implementing exception handling for our BizTalk services, and have run into a
We're implementing a hosted Windows SharePoint Services 3.0 system and I need to limit
Implementing Equals() for reference types is harder than it seems. My current canonical implementation
Implementing a 'sandbox' environment in Python used to be done with the rexec module

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.