gpt4 book ai didi

ios - 适用于后端 iOS 凭据的 Google Sign In API (Swift)

转载 作者:行者123 更新时间:2023-11-30 11:04:44 24 4
gpt4 key购买 nike

我已经在我的 iOS 应用程序中实现了 Google Sign In,并且我想将用户的 ID token 发送到我的服务器进行验证。我已经通过 Google Cloud Platform Console 创建了 iOS 客户端 ID,尽管我在应用程序和服务器上使用相同的客户端 ID,但当我向服务器发送请求时,服务器会抛出 500 错误。我应该使用另一种客户端 ID 吗?

最佳答案

    *

Error code 500 is an internal server error. so check issues using postman.

@IBAction func GoogleLoginBtn(_ sender: Any) {
GIDSignIn.sharedInstance().signIn()
}

func sign(_ signIn: GIDSignIn!, didDisconnectWith user:GIDGoogleUser!,withError error: Error!) {
print(error)
return
}

func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) {

if (error == nil) {
// Perform any operations on signed in user here.
id = user.userID
Name = user.profile.name
Email = user.profile.email
url = String(describing: user.profile.imageURL(withDimension: (400))!)
}
}

In-app delegate:-
GIDSignIn.sharedInstance().clientID = "76lp4.apps.googleusercontent.com"
// paste ur reverse client id here
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
print("UIApplicationOpenURLOptionsKey.sourceApplication.rawValue: \(UIApplicationOpenURLOptionsKey.sourceApplication.rawValue)")
print("UIApplicationOpenURLOptionsKey.annotation.rawValue: \(UIApplicationOpenURLOptionsKey.annotation.rawValue)")
return GIDSignIn.sharedInstance().handle(url as URL?,
sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as! String?,
annotation: options[UIApplicationOpenURLOptionsKey.annotation])
}

*

关于ios - 适用于后端 iOS 凭据的 Google Sign In API (Swift),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52850554/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com