简体   繁体   English

如何在Spring应用程序中为Firebase获取Oauth 2.0访问令牌

[英]How can i get a Oauth 2.0 access token for firebase in my Spring app

I am trying to retrieve an Oauth 2.0 access token in my Spring boot application so i can send push notification via my server. 我试图在我的Spring启动应用程序中检索Oauth 2.0访问令牌,以便我可以通过服务器发送推送通知。 I followed firebase documentation but they failed to show an example of how to retrieve the token with the google client library they stated and also how to link the private key json file with it. 我遵循了Firebase文档,但他们未能显示一个示例,说明如何使用他们声明的Google客户端库检索令牌以及如何将私钥json文件与其链接。 Presently i have downloaded and saved the private key file on my system and also imported the Google API Client Library via maven. 目前,我已经在系统上下载并保存了私钥文件,还通过maven导入了Google API客户端库。 But i am stuck on how to actually use them to get a token. 但是我对如何实际使用它们来获取令牌感到困惑。

Please an assistance here in terms of a code snippet will be helpful. 请在代码段方面为您提供帮助。

You can use the OAuthRestTemplate, you just configure it as a bean and it will automatically get tokens as needed. 您可以使用OAuthRestTemplate,只需将其配置为Bean,它将根据需要自动获取令牌。

Here is one page with examples, but there are tons online depending on what type of token you are using. 这是一个包含示例的页面,但在线数量取决于您使用的令牌类型。 OAuthRestTemplate Examples OAuthRestTemplate示例

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

相关问题 Azure Spring Boot-获取已登录用户的OAuth 2.0访问令牌 - Azure Spring Boot - Get OAuth 2.0 Access Token of Logged In User 如何将OAuth 2.0授权代码交换为访问令牌? - How do I exchange a OAuth 2.0 authorization code for an access token? Java OAuth 2.0 获取访问令牌 - Java OAuth 2.0 get access token 如何获得对Javafx Spring Boot桌面应用程序的OAuth2访问令牌? - What should I do to get an OAuth2 access token to my javafx spring boot desktop application? Spring OAuth2.0:spring存储访问令牌的位置是什么? - Spring OAuth2.0: Where does spring store the access token? 从Spring RESTful资源服务器验证OAuth 2.0访问令牌 - validate OAuth 2.0 access token from a Spring RESTful resource server 使用 OAuth 2.0 Google App Engine 刷新访问令牌 - Refresh Access Token with OAuth 2.0 Google App Engine 如何将 OAuth 2.0 添加到我的 Spring 项目中? - How to add OAuth 2.0 to my Spring project? Spring Security oAuth 2.0 UAA合法获取令牌值 - Spring Security oAuth 2.0 UAA get token value authomatically 在登录Facebook App并授权我的应用程序后,如何才能正确获取访问令牌和其他信息? [Android]产品 - How can I get Access Token and other info correctly after logging in Facebook App and authorizing my app? [Android]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM