PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, May 16, 2022

[FIXED] How to handle google one tap with laravel csrf

 May 16, 2022     csrf, google-one-tap, laravel, php, post     No comments   

Issue

I tried adding google one tap on a laravel app.

    <div id="g_id_onload"
         data-client_id="{{ config('google.google_client_id') }}"
         data-login_uri="{{ route('google2.callback') }}"
         _token="{{ csrf_token() }}">
    </div>

But I still get a 419 PAGE EXPIRED with a CSRF Token mismatch exception with and without the _token parameter. How should I handle this on the post route?


Solution

For anyone with this problem the issue is that every parameter must be preceded by data- so it has to be:

 <div id="g_id_onload"
         data-client_id="{{ config('google.google_client_id') }}"
         data-login_uri="{{ route('google2.callback') }}"
         data-_token="{{ csrf_token() }}">
</div>


Answered By - grimdbx
Answer Checked By - Marilyn (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing