Fetch the repository succeeded.
This action will force synchronization from 625/Google-Mail-Api-Java, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
采用谷歌服务账号的方式授权访问API,授权方式为oauth2.0的客户端模式。 开发前,先需要完成以下授权过程
yamibuy.com
damon.li@yamibuy.com
mail-service-account
,一路点击完成118087448170978300761
,后续添加访问权限使用https://www.googleapis.com/auth/gmail.send
接口 | 请求方式 | 请求地址 |
---|---|---|
授权获取token | POST | https://oauth2.googleapis.com/token |
发送邮件 | POST | https://www.googleapis.com/gmail/v1/users/me/messages/send |
{
# 谷歌源码写死的类型
"grant_type":"urn:ietf:params:oauth:grant-type:jwt-bearer",
"assertion":"Jwt-Token"
}
{
header:{
algorithm: 'RS256',
type: 'JWT',
keyId: '[serviceAccountPrivateKeyId]'
}
paylload:{
id: '[serviceAccountPrivateKeyId]',
issuer: '[serviceAccountId]',
audience: '[tokenServerEncodedUrl]',
issuedAt: '[当前时间]',
expiration: '当前时间+3600',
subject: '[email]',
scope: 'https://www.googleapis.com/auth/gmail.send'
}
}
{
raw: "[Base64.encodeUrlSafe后的 RFC2822邮件]"
}
Sign in to post a comment
Repository Comments ( 0 )