【问题标题】:How to do Google backend authentication of access token in Laravel 5.2?如何在 Laravel 5.2 中对访问令牌进行谷歌后端身份验证?
【发布时间】:2016-04-11 21:28:13
【问题描述】:

我想在 Laravel 中执行 Google 的后端验证。很抱歉造成混乱。

我想获取经过 Google 验证的用户的访问令牌。

有人知道怎么做吗?

【问题讨论】:

  • Socialite 来自 Laravel 开发团队,你有什么理由不想使用它?

标签: laravel laravel-5 google-authentication


【解决方案1】:

您可以使用 cURL 或 Guzzle 并通过 Google API 手动进行身份验证。

【讨论】:

    【解决方案2】:

    您应该接受 Alex Cobb 的回答,因为它是正确的。但由于它很短: 其他人有类似的 guzzle/socialite 问题,并且有一个可接受的代码摘录: Making requests to Google API using Guzzle and Socialite in Laravel 5

    以防万一您需要 Guzzle 信息: http://www.pixelite.co.nz/article/guzzle-http-post-authentication-and-form-submission-symfony-20/

    这显示了在进行 curl 调用时 PHP 解决方案是如何 guzzle 的。

    重要提示:

    为什么要重新发明轮子,laravel 与社交名流开箱即用:

    Laravel 社交名媛介绍

    Laravel Socialite 为 OAuth 提供了一个富有表现力、流畅的接口 通过 Facebook、Twitter、Google、LinkedIn、GitHub 和 比特桶。它处理几乎所有样板社交 你最怕写的验证码。

    https://github.com/laravel/socialite

    【讨论】:

      猜你喜欢
      • 2018-11-22
      • 1970-01-01
      • 2015-06-02
      • 1970-01-01
      • 1970-01-01
      • 2017-04-11
      • 2023-01-29
      • 2021-05-07
      • 2014-02-11
      相关资源
      最近更新 更多