50 lines
1015 B
Markdown
50 lines
1015 B
Markdown
|
|
# Google Token Verifier
|
||
|
|
|
||
|
|
Small Vercel endpoint used by the China-hosted API to verify Google ID tokens from an overseas network.
|
||
|
|
|
||
|
|
## Environment Variables
|
||
|
|
|
||
|
|
- `GOOGLE_TOKEN_VERIFIER_SECRET`: shared bearer token. Use the same value in the API.
|
||
|
|
- `GOOGLE_OAUTH_CLIENT_IDS`: comma-separated Google OAuth client IDs allowed for this app.
|
||
|
|
|
||
|
|
## Endpoint
|
||
|
|
|
||
|
|
`POST /api/verify-google-token`
|
||
|
|
|
||
|
|
Headers:
|
||
|
|
|
||
|
|
```http
|
||
|
|
Authorization: Bearer <GOOGLE_TOKEN_VERIFIER_SECRET>
|
||
|
|
Content-Type: application/json
|
||
|
|
```
|
||
|
|
|
||
|
|
Body:
|
||
|
|
|
||
|
|
```json
|
||
|
|
{
|
||
|
|
"id_token": "google-id-token"
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
Success response:
|
||
|
|
|
||
|
|
```json
|
||
|
|
{
|
||
|
|
"subject": "google-sub",
|
||
|
|
"email": "user@example.com",
|
||
|
|
"email_verified": true,
|
||
|
|
"name": "User Name",
|
||
|
|
"picture": "https://...",
|
||
|
|
"audience": "google-client-id",
|
||
|
|
"issuer": "https://accounts.google.com"
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
## Deploy
|
||
|
|
|
||
|
|
Deploy this directory as an independent Vercel project. Point the API env var `GOOGLE_TOKEN_VERIFIER_URL` to the full endpoint URL, for example:
|
||
|
|
|
||
|
|
```text
|
||
|
|
https://your-project.vercel.app/api/verify-google-token
|
||
|
|
```
|