Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Authenticated Requests in OAuth Java

If anyone has experience in using http://oauth.googlecode.com/svn/code/java/core/ and the example server in this code, perhaps you could explain to me how is the Authenticated Requests handling implemented? Reference on: https://www.rfc-editor.org/rfc/rfc5849#section-3

So, when a user is authenticated and the protected recourse server just wants to confirm the authenticity against the OAuth provider.

like image 720
elector Avatar asked Nov 03 '22 00:11

elector


1 Answers

Create a new Project from Google API Console and get Client Id and Secret Key. https://code.google.com/apis/console

Following this example https://code.google.com/p/google-api-java-client/wiki/OAuth2Draft10 as a help to Develop OAUTH Client Plugin for Google.

Make sure that you have changed your scope, call back URL and shortend URL etc according to your needs.

private static final String SCOPE = "https://www.googleapis.com/auth/urlshortener";
private static final String CALLBACK_URL = "urn:ietf:wg:oauth:2.0:oob";
...


GenericUrl shortenEndpoint = new GenericUrl("https://www.googleapis.com/urlshortener/v1/url");

This page will help you to understand authentication and authorization flow https://developers.google.com/accounts/docs/OAuth2

Helpful Things for Google OAUTH

OAuth 2.0 Playground

Awesome Playground. This will make OAuth with your app and get your desired information. In other words you can see how will your application run for OAUTH and what information is required to code OAUTH for Google. https://developers.google.com/oauthplayground/

Verify Access Token

Verify your access token from this URL https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=***

like image 153
Muhammad Imran Tariq Avatar answered Nov 11 '22 16:11

Muhammad Imran Tariq