【发布时间】:2018-05-16 06:57:56
【问题描述】:
我正在使用 oAuth2.0 从我的 Gmail 帐户中读取电子邮件。这是我的代码
oauthswift = OAuth2Swift(
consumerKey: "242468529977-xxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com",
consumerSecret: "GfGVl_xxxxxxxxxxmjnAX",
authorizeUrl: "https://accounts.google.com/o/oauth2/auth",
accessTokenUrl: "https://accounts.google.com/o/oauth2/token",
responseType: "code"
)
oauthswift?.allowMissingStateCheck = true
let _ = oauthswift?.authorize(
withCallbackURL: URL(string: "urn:ietf:wg:oauth:2.0:oob")!, scope: "https://www.googleapis.com/auth/gmail.metadata", state: "",
success: { credential, response, parameters in
let parameters = Dictionary<String, AnyObject>()
// Multi-part upload
print(credential)
print(response)
},
failure: { error in
print("ERROR: \(error.localizedDescription)")
}
)
但在我允许后,它会显示这个屏幕
并说'请复制此代码并切换到应用程序并将其粘贴到那里。'但我不知道在哪里粘贴代码。
【问题讨论】:
-
Jecky consumerSecret: "",请删除您的键值并尝试它对我的工作
标签: ios swift oauth-2.0 gmail-api email-attachments