Hi all,
I need invocate google to get information account for my web site. I use OAuth 2.0 but I don't understand very well. I need help please.
I user 2 method:
Method 1... Step 1 and 2
Step 1
String next = "http://www.example.com/welcome.html";
String scope = "https://www.google.com/m8/feeds/";
boolean secure = false;
boolean session = true;
String authSubLogin = AuthSubUtil.getRequestUrl(next, scope, secure,
session);
It's OK
Step 2
String token = request.getParameter("token");
I get token!!! but then how I can get user information? Where I use my
secret id and password?
Method 2... Step 1 and 2
STEP 1
String clientId = "xxxxxxxxxxx";
String callback = "http://" + request.getServerName() + ":" +
request.getServerPort() + request.getContextPath() + "/myUrl.jsp";
String authUrl = "https://accounts.google.com/o/oauth2/auth?
client_id=" + clientId + "&redirect_uri=" + callback + "&scope=https://
www.google.com/m8/feeds/&response_type=code";
response.sendRedirect(authUrl);
STEP 2 (myUrl.jsp)
String code = request.getParameter("code");
String clientSecret = "yyyyyyyyyyyyyyyyyyyyy";
String newUrl = "https://accounts.google.com/o/oauth2/token";
String clientId = "xxxxxxxxxxxxxxxxxxxxxxxxx";
String callback = "http://" + request.getServerName() + ":" +
request.getServerPort() + request.getContextPath() + "/myUrl.jsp";
- mostra testo citato -
and then? How I can get User information?
Which is right version? Method 1 or 2?
Can you help me?
Please
Thanks in advance