https://github.com/willtpwise/google-sign-in-php
Backend PHP authentication for Google Sign In
https://github.com/willtpwise/google-sign-in-php
Last synced: 11 days ago
JSON representation
Backend PHP authentication for Google Sign In
- Host: GitHub
- URL: https://github.com/willtpwise/google-sign-in-php
- Owner: willtpwise
- Created: 2017-08-07T21:32:52.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-07T23:33:08.000Z (almost 9 years ago)
- Last Synced: 2025-07-10T21:38:46.575Z (12 months ago)
- Language: PHP
- Size: 3.5 MB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Google Sign In (PHP Backend)
Authenticate a Google Sign In token on the backend with PHP. The authenticator
will validate the user's Google ID Token.
## Install
```shell
$ php bin/composer install
```
## Usage
Make an HTTPS Post request to `data/example.php` and pass a Google Sign In token
as `token`
```javascript
var xhr = new XMLHttpRequest();
xhr.open('POST', 'https://yourbackend.example.com/data/example.php');
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onload = function() {
console.log(JSON.parse(xhr.responseText));
};
xhr.send('token=' + id_token);
```
## Returns
The authenticator will return your content, or a JSON object on error / failure
On error / failure, the JSON object will look like so:
```json
{
"status": false,
"body": ""
}
```