OAuth と Therefore™ |
Scroll |
認可コード グラント
tenant Therefore テナント名(必須)
client_id アプリケーションに登録されているクライアント ID
redirect_uri OAuth 仕様で定義された状態
scope •Therefore_Read ― 読み取り専用アクセス •Therefore_User ― 利用者権限でのアクセス •offline_access ― リフレッシュ トークンを要求
response_type OAuth 仕様で定義された状態
アクセス トークンの入手要求の例
POST https://oauth.thereforeonline.com/OAuth/Token?tenant=NTWare1 Authorization: Basic <hidden> → clientid:clientsecret
Body: code=<auth_code>&redirect_uri=<redirect_uri>&grant_type=authorization_code
Response: { "access_token": "<token>", "token_type": "bearer", "expires_in": 1199, "refresh_token": "<token>" }
リフレッシュ トークンでの、新しいアクセス トークンの要求例
POST https://oauth.thereforeonline.com/OAuth/Token?tenant=NTWare1 Authorization: Basic <hidden> → clientid:clientsecret
Body: refresh_token=<refresh_token>&grant_type=refresh_token
Response: { "access_token": "<token>", "token_type": "bearer", "expires_in": 1199, "refresh_token": "<token>" }
発行された OAuth トークンは、すべての Web API リクエストで(Auth Header の)べアラー トークンとして使用できます。Therefore では、OAuth を有効にし、クライアントを有効なクライアントとして追加する必要があります。 クライアント アプリケーションがここで追加されない場合は、通常は有効なトークンでも接続に失敗します。これは、特定のアプリケーションの Therefore™ へのアクセスを無効にする簡単な方法でもあります。
OAuth が生成したトークンは、Therefore™ Web Client、Portal、API、WebAPI で Therefore™ のユーザー認証に使用できます。
Web Client の例: https://<server>/TWA/Client/Web/Viewer/Viewer.aspx?docno=349738&ssoToken=<token> https://<server>/TWA/Portal/Portal.aspx?qNo=123&ssoToken=<token>
API の例: string sToken = "<token>; string sNodeInternal, sNodeFriendly; TheServer s = new TheServer(); s.ConnectBearerToken(TheClientType.CustomApplication, sToken, "", "", "", true, TheConnectMode.NoLicenseMove, out sNodeInternal, out sNodeFriendly);
|
---|