简体   繁体   English

使用Google OAuth2和个人休息API

[英]Using Google OAuth2 and personal rest api

How would you go about (if possible) using google OAuth2 authentication to access to gain an access token which would allow you access to your own api (one i am building). 您将如何使用Google OAuth2身份验证进行访问(如果可能)以获取访问令牌,该令牌将允许您访问自己的api(我正在构建的api)。

In my research I have come across many examples and information about using the access token to use with google's api's but not my own. 在我的研究中,我遇到了许多有关使用访问令牌与Google的api一起使用但不是我自己的api的示例和信息。

The aim is to have a use authentication to the client with a google account, at which point they are then given access to call my api (with the access token provided by google OAuth 2.0) 目的是通过google帐户对客户端进行使用身份验证,然后授予他们调用我的api的访问权限(使用google OAuth 2.0提供的访问令牌)

This is the kind of setup I am looking for. 这是我正在寻找的设置。

Using OAuth 2.0 to allow access to API 使用OAuth 2.0允许访问API

Without been too specific this would be for a java based rest api. 无需太具体,这将是基于Java的rest api。

Again is this possible and if so, any tips or references to material which describes best practices/approaches to do this would me much appreciated. 同样,这是可能的,如果是的话,任何描述最佳实践/方法的技巧或材料参考都将不胜感激。

Thanks in advance 提前致谢

I would recommend you to take a look at Spring oauth2 project which is well documented and easy to use. 我建议您看一下Spring oauth2项目,该项目有据可查且易于使用。 http://projects.spring.io/spring-security-oauth/docs/oauth2.html http://projects.spring.io/spring-security-oauth/docs/oauth2.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM