redux-toolkit 网站上的所有示例都显示了selectIds或 的用法selectAll。使用它们中的任何一个都很简单。我有一个redux-slice我要出口的地方
export const {
selectById: selectUserById,
selectIds: selectUserIds,
selectEntities: selectUserEntities,
selectAll: selectAllUsers,
selectTotal: selectTotalUsers
} = usersAdapter.getSelectors(state => state.users)
Run Code Online (Sandbox Code Playgroud)
然后我在我的组件中导入选择器并使用类似
const valueIAmInterestedIn = useSelector(selectUserIds)
Run Code Online (Sandbox Code Playgroud)
我对与selectUserById.
我希望我的服务帐户能够模拟 GSuite 中的用户之一。我有
domain-wide delegation在服务帐户设置中启用GCPAPI Client添加了service account idGSuite在浏览文档(java)时,我看到了这个
GoogleCredential credential = GoogleCredential.fromStream(new FileInputStream("MyProject-1234.json"))
.createScoped(Collections.singleton(SQLAdminScopes.SQLSERVICE_ADMIN))
.createDelegated("user@example.com");
Run Code Online (Sandbox Code Playgroud)
在这里,他们指定服务帐户应模拟哪个用户。这段代码是java中的。我需要在nodejs 中完成同样的事情。
在查看nodejs-clientfor的文档时googleapis,我发现了这一点:
const {google} = require('googleapis');
const auth = new google.auth.GoogleAuth({
keyFile: '/path/to/your-secret-key.json',
scopes: ['https://www.googleapis.com/auth/cloud-platform'],
});
Run Code Online (Sandbox Code Playgroud)
和
const {google} = require('googleapis');
const oauth2Client = new google.auth.OAuth2(
YOUR_CLIENT_ID,
YOUR_CLIENT_SECRET,
YOUR_REDIRECT_URL
);
// set auth as a global default
google.options({
auth: oauth2Client
});
Run Code Online (Sandbox Code Playgroud)
GoogleAuth和这里有什么区别OAuth2 …
node.js google-api-client google-api-nodejs-client gmail-api