Userinfo エンドポイント
Access Token を用いてソーシャルPLUS のユーザー認証情報を取得できるエンドポイント。
GET /oauth2/userinfo
リクエスト
HTTP の Authorization ヘッダーに Token エンドポイント で発行された Access Token を指定します。
Authorization: Bearer {access_token}
リクエストサンプル
curl -X GET https://api.socialplus.jp/oauth2/userinfo \
-H 'Content-Type: application/json; charset=utf-8' \
-H 'Authorization: Bearer 0fe9cfe59efca93d602abaf8d1a378afd2b1a05e'
共通仕様: FQDN
エラーレスポンス
関連: 共通エラー定義
Authorization ヘッダーが存在しない、または Bearer 形式で指定されていない場合
HTTP ステータスコード 401 Unauthorized とともに、エラーコード(error)を含む JSON オブジェクトを返します。
エラーレスポンス例
HTTP/1.1 401 Unauthorized
Content-Type: application/json
{
"error": "unauthorized",
}
指定された Access Token の値が正しくないとき
HTTP ステータスコード 401 Unauthorized とともに、エラーコード(error)を含む JSON オブジェクトを返します。
HTTP レスポンスヘッダーに WWW-Authenticate フィールドを含めて返します。
この形式は以下の仕様に準拠しています。
エラーレスポンス例
HTTP/1.1 401 Unauthorized
Content-Type: application/json
WWW-Authenticate: Bearer error="invalid_token", error_description="The access token is invalid."
{
"error": "unauthorized",
}
成功レスポンス
リクエストに成功すると、HTTP ステータスコード 200 OK と、ユーザー認証情報を含む JSON オブジェクトを返します。
成功時のレスポンス例
HTTP/1.1 200 OK
Content-Type: application/json
{
"sub": "7b256cf6c3e378d354153d446d2efcc1b3028a8c",
"primary_key": "user_0001",
"provider": "line",
"provider_uid": "dffeaec8592ce668d72b",
"email": "user@example.com"
}
| パラメータ名 | 型 | 必須 | Scope | 説明 |
|---|---|---|---|---|
| sub | string | ○ | ソーシャルPLUS ID | |
| primary_key | string | ※ | お客様サービス側ユーザID ※お客様サービス側ユーザID の紐付け が完了している場合のみ返します。値がない場合はパラメータ自体返却されません。 | |
| provider | string | ○ | ログインプロバイダ(line, apple, yahoo, google, x) | |
| provider_uid | string | ○ | プロバイダ設定の識別子 | |
| name | string | profile | フルネーム | |
| name#ja-Kana-JP | string | profile | フルネーム(カナ表記) | |
| family_name | string | profile | 姓 | |
| family_name#ja-Kana-JP | string | profile | 姓(カナ表記) | |
| given_name | string | profile | 名 | |
| given_name#ja-Kana-JP | string | profile | 名(カナ表記) | |
| middle_name | string | profile | ミドルネーム | |
| preferred_username | string | profile | ユーザー名 | |
| profile | string | profile | プロフィールページの URL | |
| picture | string | profile | プロフィール画像の URL | |
| website | string | profile | ウェブサイトの URL | |
| gender | string | profile | 性別 ・男性 male・女性 female・その他 other | |
| birthdate | string | profile | 生年月日 | |
| updated_at | string | profile | ユーザー情報の更新日時 | |
| string | メールアドレス | |||
| email_verified | boolean | 検証済みのメールアドレスかどうか | ||
| phone_number | string | phone | 電話番号 | |
| address | Address object | address | Address オブジェクト 参照 |
Address オブジェクト
| パラメーター | 型 | 必須 | 説明 |
|---|---|---|---|
| formatted | string | 住所全体。region, locality, street_address を半角スペースで結合した値 | |
| street_address | string | 番地以降 | |
| locality | string | 市区町村 | |
| region | string | 都道府県 | |
| postal_code | string | 郵便番号 |