前提
- プロジェクトは事前に作成済み
- APIキーも
サイドバーの⚙️ > プロジェクトの設定 > 全般 > ウェブ API キー
から取得済み
取得方法
アカウント未作成の場合
curl -X POST \
'https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=[YOUR_API_KEY]' \
-H 'Content-Type: application/json' \
-d '{
"email": "user@example.com",
"password": "your-password",
"returnSecureToken": true
}'
# response
{
"kind": "identitytoolkit#SignupNewUserResponse",
"idToken": "*****",
"email": "user@example.com",
"refreshToken": "*****",
"expiresIn": "3600",
"localId": "*****"
}
アカウント作成済みの場合
curl -X POST \
'https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=[YOUR_API_KEY]' \
-H 'Content-Type: application/json' \
-d '{
"email": "user@example.com",
"password": "your-password",
"returnSecureToken": true
}'
# response
{
"kind": "identitytoolkit#VerifyPasswordResponse",
"localId": "*****",
"email": "user@example.com",
"displayName": "",
"idToken": "*****",
"registered": true,
"refreshToken": "*****",
"expiresIn": "3600"
}