Show / Hide Table of Contents

Class Authentication

VRoid HubとOAuth認証を行うためのシングルトンクラス

Inheritance
Object
Authentication
Implements
IAuthentication
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: VRoidSDK.OAuth
Assembly: VRoidSDK.dll
Syntax
public class Authentication : IAuthentication

Properties

Instance

シングルトンオブジェクト

Declaration
public static IAuthentication Instance { get; }
Property Value
Type Description
IAuthentication

Methods

AuthorizedRequest(String, HTTPMethods, Action<IWebResponse>, Action<Single>, Action<HttpRequestFailException>)

廃止予定: ログイン後に実行できるAPIをリクエストする

Declaration
[Obsolete("Deprecated. Please use CreateAuthorizedHttpConnection.", false)]
public void AuthorizedRequest(string requestPath, HTTPMethods methods, Action<IWebResponse> onSuccess, Action<float> onProgress, Action<HttpRequestFailException> onError)
Parameters
Type Name Description
String requestPath

実行するAPIのパス

HTTPMethods methods

リクエストのメソッド (HTTPMethods)

Action<IWebResponse> onSuccess

完了時に呼ばれるコールバック

Action<Single> onProgress

実行中に呼ばれるコールバック

Action<HttpRequestFailException> onError

エラー発生時に呼ばれるコールバック

AuthorizedRequest(String, HTTPMethods, IHttpParam, Action<IWebResponse>, Action<Single>, Action<HttpRequestFailException>)

廃止予定: ログイン後に実行できるAPIをリクエストする

Declaration
[Obsolete("Deprecated. Please use CreateAuthorizedHttpConnection.", false)]
public void AuthorizedRequest(string requestPath, HTTPMethods methods, IHttpParam param, Action<IWebResponse> onSuccess, Action<float> onProgress, Action<HttpRequestFailException> onError)
Parameters
Type Name Description
String requestPath

実行するAPIのパス

HTTPMethods methods

リクエストのメソッド (HTTPMethods)

IHttpParam param

リクエストパラメータ

Action<IWebResponse> onSuccess

完了時に呼ばれるコールバック

Action<Single> onProgress

実行中に呼ばれるコールバック

Action<HttpRequestFailException> onError

エラー発生時に呼ばれるコールバック

AuthorizedRequest(String, HTTPMethods, IHttpParam, Dictionary<String, String>, Action<IWebResponse>, Action<Single>, Action<HttpRequestFailException>)

廃止予定: ログイン後に実行できるAPIをリクエストする

Declaration
[Obsolete("Deprecated. Please use CreateAuthorizedHttpConnection.", false)]
public void AuthorizedRequest(string requestPath, HTTPMethods methods, IHttpParam param, Dictionary<string, string> headers, Action<IWebResponse> onSuccess, Action<float> onProgress, Action<HttpRequestFailException> onError)
Parameters
Type Name Description
String requestPath

実行するAPIのパス

HTTPMethods methods

リクエストのメソッド (HTTPMethods)

IHttpParam param

リクエストパラメータ

Dictionary<String, String> headers

リクエストヘッダ

Action<IWebResponse> onSuccess

完了時に呼ばれるコールバック

Action<Single> onProgress

実行中に呼ばれるコールバック

Action<HttpRequestFailException> onError

エラー発生時に呼ばれるコールバック

AuthorizedRequest(String, HTTPMethods, IHttpParam, Dictionary<String, String>, Action<IWebResponse>, Action<HttpRequestFailException>)

廃止予定: ログイン後に実行できるAPIをリクエストする

Declaration
[Obsolete("Deprecated. Please use CreateAuthorizedHttpConnection.", false)]
public void AuthorizedRequest(string requestPath, HTTPMethods methods, IHttpParam param, Dictionary<string, string> headers, Action<IWebResponse> onSuccess, Action<HttpRequestFailException> onError)
Parameters
Type Name Description
String requestPath

実行するAPIのパス

HTTPMethods methods

リクエストのメソッド (HTTPMethods)

IHttpParam param

リクエストパラメータ

Dictionary<String, String> headers

リクエストヘッダ

Action<IWebResponse> onSuccess

完了時に呼ばれるコールバック

Action<HttpRequestFailException> onError

エラー発生時に呼ばれるコールバック

AuthorizeWithExistAccount(Action<Boolean>, Action<HttpRequestFailException>)

ローカルストレージからOAuthトークンを取得し、認証を行う OAuthトークンが期限切れの場合は、古いトークンをリフレッシュし、再発行する

Declaration
public void AuthorizeWithExistAccount(Action<bool> onExistAccountAuthSuccess, Action<HttpRequestFailException> onAuthError)
Parameters
Type Name Description
Action<Boolean> onExistAccountAuthSuccess

トークンを取得した時のコールバック。成功時はtrue, 失敗した時はfalse

Action<HttpRequestFailException> onAuthError

トークンの取得に失敗した時のコールバック

BrowserAuthorized(String, String, String, String)

ブラウザを開き、OAuthトークン発行に必要な認可コードを発行する

Declaration
public void BrowserAuthorized(string redirectUri, string scope, string state, string codeChallenge)
Parameters
Type Name Description
String redirectUri

ブラウザOpen後にリダイレクトされるURL

String scope

発行するトークンのスコープ

String state

OAuthのstateパラメータ

String codeChallenge

PKCEのCode VerifierのSHA256ハッシュ値をurl safe base64でエンコードした値

CreateAuthorizedHttpConnection(String, HTTPMethods, IHttpParam, Dictionary<String, String>)

ログイン後に実行できるAPIのHttp通信を行う通信オブジェクトを作成する

Declaration
public IHttpConnection CreateAuthorizedHttpConnection(string requestPath, HTTPMethods methods, IHttpParam param, Dictionary<string, string> headers)
Parameters
Type Name Description
String requestPath

実行するAPIのパス

HTTPMethods methods

リクエストのメソッド (HTTPMethods)

IHttpParam param

リクエストパラメータ

Dictionary<String, String> headers

リクエストヘッダ

Returns
Type Description
IHttpConnection

HTTP接続オブジェクト

Remarks

作成したHTTP接続オブジェクトにOnSuccess、OnErrorなどのイベントハンドラを設定して、RequestもしくはRequestAsyncを呼び出すことでリクエストを開始できます。

Init(AuthenticateMetaData)

認証オブジェクトを初期化する

Declaration
public void Init(AuthenticateMetaData metaData)
Parameters
Type Name Description
AuthenticateMetaData metaData

アプリケーションの認証情報

IsAuthorized()

アプリケーションが認証されているか

Declaration
public bool IsAuthorized()
Returns
Type Description
Boolean

認証されている: true, 認証されていない: false

Logout()

アプリケーション認証情報を破棄し、ログアウトする

Declaration
public void Logout()

OnCompleteBrowseAuthorize()

BrowseAuthorizeが完了した時に呼び出す

Declaration
public void OnCompleteBrowseAuthorize()

RefreshExistAccountForce(Action<Boolean>, Action<HttpRequestFailException>)

トークンを強制的にリフレッシュし、再発行する

Declaration
public void RefreshExistAccountForce(Action<bool> onExistAccountAuthSuccess, Action<HttpRequestFailException> onAuthError)
Parameters
Type Name Description
Action<Boolean> onExistAccountAuthSuccess

トークンを取得した時のコールバック。成功時はtrue, 失敗した時はfalse

Action<HttpRequestFailException> onAuthError

トークンの取得に失敗した時のコールバック

RegisterCode(String, String, String, Action<Boolean>)

認可コードをもとにトークンを発行する 認可コードはブラウザ認証をもとに発行される

Declaration
public void RegisterCode(string oauthCode, string redirectUri, string codeVerifier, Action<bool> onRegistered)
Parameters
Type Name Description
String oauthCode

ブラウザ認証により受け取る認可コード

String redirectUri

トークン発行後に遷移するリダイレクト先

String codeVerifier

PKCEのCode Verifier

Action<Boolean> onRegistered

トークンを取得した時のコールバック。成功時はtrue, 失敗した時はfalse

Implements

IAuthentication
Back to top Generated by DocFX