Google・Facebook・Discord ほか主要プロバイダの認証フローを内蔵。
UniWebView は主要プロバイダ向けの認証フローヘルパーを同梱しています。Inspector で Client ID を一度設定し、StartAuthenticationFlow() を呼び出すだけ。結果は Unity の標準イベントで型付きトークンとして返り、リダイレクト URL の自前処理は不要です。
ドキュメント ↗using UnityEngine;
public class GoogleSignIn : MonoBehaviour {
void Start() {
var flow = GetComponent<UniWebViewAuthenticationFlowGoogle>();
flow.StartAuthenticationFlow();
}
public void OnGoogleTokenReceived(UniWebViewAuthenticationGoogleToken token) {
Debug.Log("Access token: " + token.AccessToken);
}
public void OnGoogleAuthError(long errorCode, string errorMessage) {
Debug.LogError("Auth failed: " + errorCode + " " + errorMessage);
}
}