Blogger API v3.0 -与用户一起工作(OAuth 2.0)

时间:2021-11-26 06:43:58

Please see this documentation link: https://developers.google.com/blogger/docs/3.0/using#WorkingWithUsers

请查看这个文档链接:https://developers.google.com/blogger/docs/3.0/using#WorkingWithUsers

So, I'm trying to 'get a user' by user ID. This is a blogger blog user. We are the owners of the blog and the site respectively, and all the blogger accounts are our staffs. Now I want to have an author profile page. So the question is how do I actually do this? Seeing as I definitely don't want to display some sort of authorisation screen just to get some author information? How do I achieve this does anybody know??

所以,我试图通过用户ID“获取用户”,这是一个博客用户。我们分别是博客和网站的所有者,所有的博客账户都是我们的员工。现在我想要一个作者简介页面。问题是,我该怎么做呢?因为我绝对不想展示某种授权屏幕只是为了得到一些作者的信息?我是怎么做到的有人知道吗?

Many thanks in advance.

提前感谢。

1 个解决方案

#1


3  

This question is extreamly broad. I will try to get you started but I think if you have any issues you should probably open additial questions.

这个问题极其广泛。我会试着让你们开始,但是我认为如果你们有任何问题,你们应该提出更多的问题。

First of let me start by saying blogger is a pain and this is not going to be easy. This is because in order to access blogger for your different users you are going to have to authenticate each one using Oauth2 and get a refresh token for each one. This is done with the webpage authentication pop up window. Let me stress this is the only way you can not use a service account with blogger. you can read more about Oauth2 in my tutorial here Google Developer Console Oauth2 credentials it explains how to set up the account on google developer console.

首先,让我先说博主很痛苦,这并不容易。这是因为为了访问不同用户的blogger,您需要使用Oauth2对每个用户进行身份验证,并为每个用户获取一个refresh token。这是通过网页认证弹出窗口完成的。我要强调的是,这是你不能使用一个服务帐户与博主。在我的本教程中,您可以阅读更多关于Oauth2的内容。

Second I recommend you go with the official google .net client library

其次,我建议您使用官方的谷歌客户端库

PM> Install-Package Google.Apis.Blogger.v3

点>安装包Google.Apis.Blogger.v3

Once you have both of those its a simple matter of authenticating. The client library stores the information locally on your machine so you will have a refresh token. You could create your own implementation of idatastore and then store the refresh tokens as you need so you will be able to access them when needed you will then be able to access the user info for each of the different blogger accounts. Again they will all have to be authenticated one at a time.

一旦你有了这两个,这是一个简单的认证问题。客户端库在您的机器上本地存储信息,因此您将获得一个refresh token。您可以创建自己的idatastore实现,然后根据需要存储refresh token,以便您可以在需要时访问它们,然后可以访问每个不同的blogger帐户的用户信息。同样,它们都必须一次验证一个。

I have a sample project with some code for Blogger on GitHub it might help you get started.

我有一个关于GitHub上的Blogger的代码示例项目,它可能会帮助你开始。

#1


3  

This question is extreamly broad. I will try to get you started but I think if you have any issues you should probably open additial questions.

这个问题极其广泛。我会试着让你们开始,但是我认为如果你们有任何问题,你们应该提出更多的问题。

First of let me start by saying blogger is a pain and this is not going to be easy. This is because in order to access blogger for your different users you are going to have to authenticate each one using Oauth2 and get a refresh token for each one. This is done with the webpage authentication pop up window. Let me stress this is the only way you can not use a service account with blogger. you can read more about Oauth2 in my tutorial here Google Developer Console Oauth2 credentials it explains how to set up the account on google developer console.

首先,让我先说博主很痛苦,这并不容易。这是因为为了访问不同用户的blogger,您需要使用Oauth2对每个用户进行身份验证,并为每个用户获取一个refresh token。这是通过网页认证弹出窗口完成的。我要强调的是,这是你不能使用一个服务帐户与博主。在我的本教程中,您可以阅读更多关于Oauth2的内容。

Second I recommend you go with the official google .net client library

其次,我建议您使用官方的谷歌客户端库

PM> Install-Package Google.Apis.Blogger.v3

点>安装包Google.Apis.Blogger.v3

Once you have both of those its a simple matter of authenticating. The client library stores the information locally on your machine so you will have a refresh token. You could create your own implementation of idatastore and then store the refresh tokens as you need so you will be able to access them when needed you will then be able to access the user info for each of the different blogger accounts. Again they will all have to be authenticated one at a time.

一旦你有了这两个,这是一个简单的认证问题。客户端库在您的机器上本地存储信息,因此您将获得一个refresh token。您可以创建自己的idatastore实现,然后根据需要存储refresh token,以便您可以在需要时访问它们,然后可以访问每个不同的blogger帐户的用户信息。同样,它们都必须一次验证一个。

I have a sample project with some code for Blogger on GitHub it might help you get started.

我有一个关于GitHub上的Blogger的代码示例项目,它可能会帮助你开始。