マニフェストファイルは、ミニアプリのメタデータをホストアプリに伝えるために使用します。
マニフェストはミニアプリのダウンロード前にホストアプリによって取得され、ホストアプリはこの情報をもとに次のような挙動を行うことができます
- ミニアプリをダウンロードする前に承諾画面を表示する。承諾画面には、ミニアプリで取得したいユーザーのパーミッションや、ホストアプリ側で必要な情報(利用規約、個人情報保護方針、概要など)についての承諾を求めることができます
- ミニアプリのタグ付け・分類。
- 解析などその他の目的のために必要なカスタムデータフィールドを追加する。
Mini App Manifest Processing Flow Chart
manifest.json
ミニアプリアセットのルートディレクトリにmanifest.jsonというファイルを作成し、ZIPファイルに格納してRASポータルにアップロードしてください。以下はその例です。
MyMiniApp.zip
├── manifest.json
├── index.html
├── css
│ └── myStyles.css
以下にmanifest.jsonの例を示しています。各フィールドについては後述します。この例は「利用規約」の承諾画面への使用を想定したものです。実際のホストアプリでは、それぞれに必要なパラメータを設定していただく必要があります。
manifest.jsonの例
{
// The mini app should use "reqPermissions" for setting which permissions it requires.
// These permissions will be requested by the host app before launching and downloading the mini app.
// The user MUST accept these permissions before the mini app can be launched.
"reqPermissions"
: [
{
"name"
:
"rakuten.miniapp.user.USER_NAME"
,
"reason"
:
"Describe your reason here (optional)."
},
{
"name"
:
"rakuten.miniapp.user.PROFILE_PHOTO"
,
"reason"
:
"Describe your reason here (optional)."
}
],
// The mini app should use "optPermissions" for setting which permissions it will optionally use.
// These permissions will be requested by the host app before launching and downloading the mini app.
// The user can choose to either accept or deny these permissions before the mini app is launched.
"optPermissions"
: [
{
"name"
:
"rakuten.miniapp.user.CONTACT_LIST"
,
"reason"
:
"Describe your reason here (optional)."
},
{
"name"
:
"rakuten.miniapp.device.LOCATION"
,
"reason"
:
"Describe your reason here (optional)."
},
{
"name"
:
"rakuten.miniapp.user.action.SEND_MESSAGE"
,
"reason"
:
"Describe your reason here (optional)."
},
{
"name"
:
"rakuten.miniapp.user.ACCESS_TOKEN"
,
"reason"
:
"Describe your reason here (optional)."
}
],
// For access tokens, can define which "audience" and "scopes" you would like permission to use
"accessTokenPermissions"
: [
{
"audience"
:
"rae"
,
"scopes"
: [
"idinfo_read_openid"
,
"memberinfo_read_point"
]
},
{
"audience"
:
"api-c"
,
"scopes"
: [
"your_service_scope_here"
]
}
],
// The Host App can require additional keys that the mini app developer must set
"customMetaData"
: {
"provider"
:
"Your Company Name"
,
"description"
:
"Description of your Mini App."
,
"fileSizeInMb"
:
"2.3"
,
"importantNotice"
:
"Lorem ipsum dolor set."
,
"termsLink"
:
"https://www.example.com"
,
"privacyPolicyLink"
:
"https://www.example.com"
}
}
パーミッション
reqPermissions
とoptPermissions
ミニアプリでユーザーから取得したいパーミッション設定に使用するブロックです。リストアップしたパーミッションは、ミニアプリのダウンロードまたは起動前にユーザーにリクエストされます。特にパーミッションを設定しなかった場合、ミニアプリではそのパーミッションを使用できなくなります
reqPermissions
- 必須のパーミッション。ミニアプリを実行するために必ず必要なパーミッションです。これらのパーミッションを承諾していないユーザーはミニアプリを起動できません。optPermissions
- 任意のパーミッション。できれば取得したいが必須ではないパーミッションです。ユーザーは、これらのパーミッションを付与してもしなくてもミニアプリを利用できます。
これらの鍵はそれぞれ、必要なパーミッションを表すオブジェクト配列として設定されます。パーミッションは次の2つのプロパティで構成されます
name
- 取得したいパーミッションを表す文字列。- SDKがサポートするカスタムパーミッション名 (see CustomPermissionName) 参照)のいずれかに対応している必要があります。また "rakuten.miniapp.". で始まる名前でなければなりません。SDKに認識されないパーミッション名は無視されます。
reason
(任意)-ミニアプリにパーミッションが必要な理由を記述した文字列。
Access Token Permissions
If you wish to use Access Tokens in your MiniApp, then you must set the accessTokenPermissions
block. This defines which services and scopes you would like permission to use when requesting an Access Token.
The Host App may deny your usage of the Access Token if you request scopes which your MiniApp isn't authorized to use.
Each entry consists of the following properties:
audience
- String representing which service the Access Token is for. Can be "rae" or "api-c".scopes
- Array of strings representing the scopes you want for the access token.
Custom Meta Data
This key/values under customMetaData
are used for displaying a T&C/Permissions Approval screen before your MiniApp is downloaded. The following key/values should be defined:
provider
- name of your companydescription
- description of your MiniAppfileSizeInMb
- size of the ZIP file for your MiniApp in MBimportantNotice
- this field should be used for any important information you wish to convey to users before your MiniApp is downloadedtermsLink
- URL link to your Terms & ConditionsprivacyPolicyLink
- URL link to your privacy policy
マニフェストの保管とセキュリティ
これは秘密情報または機密情報を渡すことを想定した機能ではありません。
サンプルファイル
このファイルはあくまでデモ用です。example-manifest.json
{
"customMetaData": {
"provider": "Your Company Name",
"description": "Description of your MiniApp.",
"fileSizeInMb": "2.3",
"importantNotice": "Lorem ipsum dolor set.",
"termsLink": "https://www.example.com",
"privacyPolicyLink": "https://www.example.com"
},
"reqPermissions": [
{
"name": "rakuten.miniapp.user.USER_NAME",
"reason": "Describe your reason here (optional)."
},
{
"name": "rakuten.miniapp.user.PROFILE_PHOTO",
"reason": "Describe your reason here (optional)."
}
],
"optPermissions": [
{
"name": "rakuten.miniapp.user.CONTACT_LIST",
"reason": "Describe your reason here (optional)."
},
{
"name": "rakuten.miniapp.device.LOCATION",
"reason": "Describe your reason here (optional)."
},
{
"name": "rakuten.miniapp.user.action.SEND_MESSAGE",
"reason": "Describe your reason here (optional)."
},
{
"name": "rakuten.miniapp.user.ACCESS_TOKEN",
"reason": "Describe your reason here (optional)."
}
],
"accessTokenPermissions": [
{
"audience": "rae",
"scopes": ["idinfo_read_openid", "memberinfo_read_point"]
}
]
}