go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

Please advise on the respective responsibilities of api and rpc services.

Open gerardhb opened this issue 3 years ago • 10 comments

参考了几个项目,但发现RPC的职责都比较重,大部分业务都是在RPC中完成,api完全充当了网关。对此我产生了疑惑,他们为什么会把大部分的职责都给了RPC,api和RPC的职责到底如何很好的划分呢,希望跟大家讨论讨论。

gerardhb avatar Nov 28 '22 11:11 gerardhb

用户登录,生成token的逻辑是放在RPC服务,还是在API呢?

gerardhb avatar Nov 28 '22 11:11 gerardhb

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Is the logic of user login and token generation placed in the RPC service or in the API?

Issues-translate-bot avatar Nov 28 '22 11:11 Issues-translate-bot

我现在要对接一个第三方SSO登录,我去获取SSOToken时,会有一个重定向的回调,通过重定向回调获取SSOToken,然后在通过SSOToken获取用户信息。获取用户信息的接口,我写在了RPC服务中,但是回调又需要API。所以我在想要不要把获取用户信息的逻辑也写在API服务,当然也可以把这个重定向的接口,继续从API调到RPC,只不过让API当了一次网关,但是会加长流程的时长。

gerardhb avatar Nov 28 '22 11:11 gerardhb

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Now I want to connect to a third-party SSO login. When I go to get the SSOToken, there will be a redirection callback. The SSOToken is obtained through the redirection callback, and then the user information is obtained through the Token of SSO. I wrote the interface for obtaining user information in the RPC service, but the callback requires an API. So I am wondering whether to write the logic of obtaining user information in the API service. Of course, I can also transfer the redirected interface from the API to the RPC. It just makes the API a gateway, but it will lengthen the process. .

Issues-translate-bot avatar Nov 28 '22 11:11 Issues-translate-bot

usually in rpc,but there are exception,result by the project

smithyj avatar Dec 03 '22 14:12 smithyj

我现在要对接一个第三方SSO登录,我去获取SSOToken时,会有一个重定向的回调,通过重定向回调获取SSOToken,然后在通过SSOToken获取用户信息。获取用户信息的接口,我写在了RPC服务中,但是回调又需要API。所以我在想要不要把获取用户信息的逻辑也写在API服务,当然也可以把这个重定向的接口,继续从API调到RPC,只不过让API当了一次网关,但是会加长流程的时长。

Jwt生成是同时支持api和rpc端生成的。

jsonMark avatar Dec 08 '22 02:12 jsonMark

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Now I want to connect to a third-party SSO login. When I go to get the SSOToken, there will be a redirection callback. I get the SSOToken through the redirection callback, and then get the user information through the Token of SSO. I wrote the interface for obtaining user information in the RPC service, but the callback requires an API. So I am wondering whether to write the logic of obtaining user information in the API service. Of course, I can also transfer the redirected interface from the API to the RPC. It just makes the API a gateway, but it will lengthen the process. .

Jwt generation supports both api and rpc side generation.

Issues-translate-bot avatar Dec 08 '22 02:12 Issues-translate-bot

我现在要对接一个第三方SSO登录,我去获取SSOToken时,会有一个重定向的回调,通过重定向回调获取SSOToken,然后在通过SSOToken获取用户信息。获取用户信息的接口,我写在了RPC服务中,但是回调又需要API。所以我在想要不要把获取用户信息的逻辑也写在API服务,当然也可以把这个重定向的接口,继续从API调到RPC,只不过让API当了一次网关,但是会加长流程的时长。

Jwt生成是同时支持api和rpc端生成的。

jsonMark avatar Dec 08 '22 02:12 jsonMark

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Now I want to connect to a third-party SSO login. When I go to get the SSOToken, there will be a redirection callback. I get the SSOToken through the redirection callback, and then get the user information through the Token of SSO. I wrote the interface for obtaining user information in the RPC service, but the callback requires an API. So I am wondering whether to write the logic of obtaining user information in the API service. Of course, I can also transfer the redirected interface from the API to the RPC. It just makes the API a gateway, but it will lengthen the process. .

Jwt generation supports both api and rpc side generation.

Issues-translate-bot avatar Dec 08 '22 02:12 Issues-translate-bot

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Dec 09 '23 01:12 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Mar 27 '24 01:03 github-actions[bot]