Google OAuth
Generates a state parameter and authentication URL for initiating Google OAuth authentication flow.
Request
No request body or query and path parameters are required.
Response
The response contains the following structure:
status: Indicates if the request was successful
message: A brief status message
data: Contains the OAuth information with the following properties:
state: A randomly generated string that serves as the state parameter for the OAuth flow
googleAuthUrl: The complete Google authentication URL that includes all necessary parameters
Google Authentication URL Details
The generated googleAuthUrl includes several OAuth parameters:
scope: Defines the permissions requested from Google, including:
response_type: Set to "code" to receive an authorization code
access_type: Set to "offline" to receive a refresh token for obtaining new access tokens
state: The random state string generated for this authentication attempt
redirect_uri: The URL where Google will redirect after authentication (your_front_end_url_here)
client_id: The application's Google client ID
The state parameter serves as a security measure to prevent CSRF attacks by validating that the authentication response comes from the same session that initiated the request.
GET /v1/auth/google/oauth/generate-state HTTP/1.1
Host: {{baseurl}}
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
OK
{
"status": "success",
"message": "OK",
"data": {
"state": "0uf8QFFI6eFu",
"googleAuthUrl": "https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email&response_type=code&access_type=offline&state=0uf8QFFI6eFu&redirect_uri=http://localhost:3000&client_id=892662164941-9a741a6ppfhdeui6ak2ktfgjmdqunde2.apps.googleusercontent.com"
}
}
Last updated