Skip to content

Algo tushar Added Google Authentication#302

Open
algo-tushar wants to merge 3 commits intoTmeister:developfrom
algo-tushar:algo-tushar-google-auth
Open

Algo tushar Added Google Authentication#302
algo-tushar wants to merge 3 commits intoTmeister:developfrom
algo-tushar:algo-tushar-google-auth

Conversation

@algo-tushar
Copy link

Description

Added Google OAuth2 authentication feature using the access_token or id_token.

Type of change

  • Added a new endpoint for authenticating using Google (api_token or access_token). New endpoint is: /wp-json/jwt-auth/v1/google_auth.
  • The new endpoint receives two parameters (type and token). Where type can be either access_token or id_token, and token is the response received from Google OAuth2.
  • Updated code for a more efficient way to access user information before sending data as API response.
  • Updated $user->data->ID, $user->data->user_email, $user->data->user_nicename, $user->data->display_name to $user->ID, $user->user_email, $user->user_nicename, $user->display_name.

How has this been tested?

  • Used Postman Software for testing the new API endpoint using both access_token and id_token.
  • Checked error handling by testing without parameters and with wrong token.
  • After all test cases, verified the API response using /wp-json/jwt-auth/v1/token/validate and it works fine.

Test Configuration:

  • WordPress version: v6.5.3
  • PHP version: v8.2.0
  • Plugin name and version: v1.3.4

Checklist:

  • My code follows the style guidelines of this project (WordPress code standards).
  • I have performed a self-review of my own code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation (if needed).
  • My changes generate no new warnings.
  • I have described how I made my tests that prove my fix is effective or that my feature works.

@jainakshat9595
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants