Glass快速入门Java应用程序中的OAuth回调 [英] OAuth Callback in the Glass Quick Starter Java App

查看:61
本文介绍了Glass快速入门Java应用程序中的OAuth回调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上周得到了我的酒杯.正在运行Java版本的Quick Starter Glassware演示.我在使用OAuth回调时遇到了麻烦.我需要自己设置吗?还是样本中包含某个地方的来源?请帮忙!

Got my Glass last week. Working on running the Java version of the Quick Starter Glassware demo. I am having trouble with the OAuth callback. Do I need set this up myself? Or is there source included in the sample somewhere? Please help!

说明:我已经使用Java快速入门应用的代码设置了自己的项目,将其部署在EC2中,并在Google API控制台中设置了Client-ID和Client-secret.我将重定向URI设置为http://<my server>/<my-app>/oauth2callback.当我在浏览器中访问该应用程序时,出现404错误,未找到/oauth2callback.我还尝试将重定向URI设置为仅应用程序的根目录,即http://<my server>/<my app>.奇怪的是,我仍然收到未找到/oauth2callback的错误.

Clarification: I have set up my own project with the Java Quick Starter app's code, deployed it in EC2 and have set up the Client-ID and Client-secret in the Google APIs Console. I set the Redirect URI as http://<my server>/<my-app>/oauth2callback. When I visit the app in the browser, I get a 404 error that /oauth2callback is not found. I also tried setting the Redirect URI to just my app's root, i.e. http://<my server>/<my app>. Strangely, I still get the same error that /oauth2callback is not found.

其他问题:能否请您说明需要将回调URL设置为什么?快速入门演示应用程序中已经包含处理程序代码,还是我需要提供该代码?

Additional questions: Can you please clarify what the callback URL needs to be set to? Is the handler code already included in the quick-start-demo app or do I need to provide that code?

推荐答案

我认为问题在于您没有使用实际映射到服务器和servlet容器的URL.尝试直接从浏览器中访问URL,并确保它们显示在您的服务器和Servlet容器日志中.

I think the problem is that you're not using a URL that actually maps to your server and servlet container. Try hitting the URLs directly from a browser and make sure they show up in your server and servlet container logs.

需要将回调URL设置为oauth2callback servlet,相对于通向服务器和servlet容器的路径.我不知道您是如何设置这些的,所以我只能猜测,但是听起来<my app>部分不正确.

The callback url needs to be set to the oauth2callback servlet, relative to the path that leads to the server and servlet container. I don't know how you've set these up, so I can only guess, but it sounds like the <my app> portion isn't correct.

处理程序代码包含在webapp中.请参见网络. xml 文件,以查看路径映射及其映射的servlet对象.在这种情况下,第53行周围的oauth2callback映射到

The handler code is included as part of the webapp. See the web.xml file to see the path mapping and the servlet object that it maps to. In this case, around line 53, oauth2callback is mapped to the com.google.glassware.AuthServlet class.

更新:另请参见发布在 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆