0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

FirebaseAuthenticationでidTokenを取得する方法

Posted at

前提

  • プロジェクトは事前に作成済み
  • 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"
}

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?