- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用Gmail API发送电子邮件。但是我得到这个错误
googleapi: Error 403: Request had insufficient authentication scopes.More details:Reason: insufficientPermissions, Message: Insufficient Permission
func getClient(config *oauth2.Config) *http.Client {
// The file token.json stores the user's access and refresh tokens, and is
// created automatically when the authorization flow completes for the first
// time.
tokFile := "token.json"
tok, err := tokenFromFile(tokFile)
if err != nil {
tok = getTokenFromWeb(config)
saveToken(tokFile, tok)
}
return config.Client(context.Background(), tok)
}
这是发送的代码:
case "pass":
templateData := struct {
VerPass string
}{
VerPass: cont1,
}
emailBody, err := parseTemplate("ver.html", templateData)
if err != nil {
fmt.Println("Parse Err")
return false, err
}
var message gmail.Message
emailTo := "To: " + to + "\r\n"
subject := "Subject: " + sub + "\n"
mime := "MIME-version: 1.0;\nContent-Type: text/html; charset=\"UTF-8\";\n\n"
msg := []byte(emailTo + subject + mime + "\n" + emailBody)
message.Raw = base64.URLEncoding.EncodeToString(msg)
// Send the message
fmt.Println("OOOOOYYYYY")
//here is the problem
b, err := ioutil.ReadFile("credentials.json")
if err != nil {
log.Fatalf("Unable to read client secret file: %v", err)
}
// If modifying these scopes, delete your previously saved token.json.
config, err := google.ConfigFromJSON(b, gmail.MailGoogleComScope)
if err != nil {
log.Fatalf("Unable to parse client secret file to config: %v", err)
}
client := getClient(config)
srv, err := gmail.New(client)
if err != nil {
log.Fatalf("Unable to retrieve Gmail client: %v", err)
}
//GmailService
res, err := srv.Users.Messages.Send("me", &message).Do() // change me
if err != nil {
fmt.Println("Res Err")
fmt.Println(err)
return false, err
}
fmt.Println(res)
我尝试了
for config, err := google.ConfigFromJSON(b, gmail.MailGoogleComScope)
,尝试使用
GmailReadonlyScope
和
gmail.GmailSendScope
,但是遇到了同样的错误。
最佳答案
Request had insufficient authentication scopes.
gmail.GmailReadonlyScope
用作作用域,这只会给您只读访问权限。
mail.MailGoogleComScope
范围,该范围应该可以工作,但是我想您忽略了重新授权该应用程序。而且在教程中没有看到评论
// If modifying these scopes, delete your previously saved token.json.
关于go - googleapi : Error 403: Request had insufficient authentication scopes.更多详细信息: Reason: insufficientPermissions,消息:权限不足,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65946707/
我正在编写一个节点应用程序,我想在其中混合 Reason 和原始 JavaScript。 This section在 bucklescript 文档中对其进行了描述 When user has an
为了将现有的基于 JS 的 WebUI 重构为 ReasonML,我试图嵌入一些重构的代码。目前,我通过将所有 ReasonML 代码(到目前为止)嵌入到 iframe 中来做到这一点。 . 空间非常
我正在尝试设置 RabbitMQ 以根据死亡原因通过死信交换路由消息(“x-death.reason”或“x-first-death-reason”都可以)。 我的理解是,当消息被发送到 DLX 时,
这是我的代码: public class FunctionalityCheckTest1 { InfModel infModel; Model model = ModelFactory
昨天我设法成功运行命令 expo build:ios 但今天早上它不起作用,我在输入凭据后收到以下错误消息: Trying to authenticate with Apple Developer P
我在 Klarna 预测试中得到了这个推理题。请帮我解决这个问题。 Question is in image 最佳答案 你是正确的 'B' 是答案1).中心 3 点,即第 3 列将保持不变2).第4列
在 JavaScript 中,你可以加入一个字符串数组,例如: fruits = ["orange", "apple", "banana"]; joined = fruits.join(", ");
当我使用“java -ea A”运行以下代码时,会触发断言更正,但我没有看到第二个参数。 public class A { public A() { assert 1==2,
我目前正在尝试原因并遇到我不理解的错误 这是我的代码: let mult = (x:float, y:float):float => x * y; 使用BuckleScript进行编译时,出现以下错误
发生了奇怪的事情。 当使用 url 调用以下 servlet 时:http://localhost:8080/Football/InsertTeam?p1_name=hkh&p2_name=klhjk
一些已经开始出现在我的代码中的东西是: {if (condition) { ; } else { ; }} ; 基本上我只想要 Child如果条件为真则渲染
首先我是自定义 TFS 的新手,我的 TFS 团队项目是 Microsoft Visual Studio Scrum 2013 的 99% vanilla 模板。所以我认为我的问题对某些人来说可能是显
我正在学习 reasonml 并且对此感到非常兴奋。我在 typescript react 代码中经常做的事情是: type Props = React.HTMLProps & { foo: bool
我在这里读过另一篇关于SO的文章,在可能的情况下,您不应该为标签生成成员(member)的。我想知道这可能是什么 DRAWBACKS ? 我说的好处是提高性能,对吗?还要别的吗? 我有一个带有100个
我试图使用 Int32 库编写一些代码,但我遇到了类型错误: let x : int = 7; Int32.abs(x) This has type: int But somewhere want
我是第一次探索 ReScript。我想使用记录类型作为我的键类型来构建 HashMap ,并且我正在寻找有关实现哈希函数的指导。 这是我的 ReScript 代码: type pointer = {
我想我是在问这个设计决定背后的基本原理。 数组可变的原因在默认情况下不可变的其他数据结构(列表、记录、散列图、集合)中显得异常突出。 这是有原因的吗?是否有不可变的替代方案? 最佳答案 确实没有“原因
在学习函数式编程时,我不断遇到“原因”这个术语,尤其是在纯函数和/或引用透明性的背景下。有人能解释一下这到底是什么意思吗? 最佳答案 通常,在编写程序时,您的工作不仅仅只是编写代码,您还想了解代码所展
考虑到以下人为的示例,是否可以编写一个可以处理具有 a 属性的任何记录的 get 函数? type type_one = {a: int} type type_two = {a: int, b: in
考虑到以下人为的示例,是否可以编写一个可以处理具有 a 属性的任何记录的 get 函数? type type_one = {a: int} type type_two = {a: int, b: in
我是一名优秀的程序员,十分优秀!