Google OAuth 2.0 invalid_request,缺少方案

hai*_*ngn 6 oauth ios swift

我无法在 ios 上授权 Google OAuth,safari 总是说

400 这是一个错误。

redirect_uri 的参数值无效:缺少方案:com.googleusercontent.apps.984813079630-3lmlrubo9345ng4qhtf62ud1i02m6ta8

在此处输入图片说明 我在 Google 控制台页面上多次检查了 API Key、Client_ID、client_secret,还在 xcode 中创建了 url 方案。

这是我的 Swift 代码:

oauthswift = OAuth2Swift(consumerKey: "xxxxx-3lmlrubo9345ng4qhtf62ud1i02m6ta8.apps.googleusercontent.com", consumerSecret: "xxxtg6qslUOC2np1sBg0hnWgBcpZb4", authorizeUrl: " https ://google.comauthv/google.comauthv/", responseType: "token" ) let handle = oauthswift.authorize( withCallbackURL: URL(string: "com.googleusercontent.apps.984813079630-3lmlrubo9345ng4qhtf62ud1i02m6ta8")!, scope: "profile", state:"GOOGLE" credential, response, parameters in print(credential.oauthToken) // 执行你的请求 }, failure: { error in print(error.localizedDescription) } )

你可以帮帮我吗 ?

Law*_*iet 0

您可能应该重新检查 Google 开发控制台。您的 clientID 可能错误地注册为Javascript Web 应用程序而不是移动应用程序