Google Playground
Test your server with Google OAuth 2.0 Playground
Once you’ve set up your server on the wild internet, you’ll want to check that it works with an independent client. One way to do this is using the Google OAuth 2.0 Playground.
Assuming that you’ve set up an authorize controller, you can test it out as follows:
-
Navigate to the Playground using the above link.
-
Click the settings button in the top-right corner.
-
Select “Server-side” for “OAuth flow”, and “Custom” for “OAuth endpoints”.
-
In the Authorization endpoint, enter the URL of your Authorize Controller (such as https://domain.com/authorize.php).
-
In the Token endpoint, enter the URL of your Token Controller (such as https://domain.com/token.php).
-
Select “Authorization header w/ Bearer prefix” for the Access token location.
-
Enter the client ID and secret (testclient and testpass if using the previous documentation example).
-
Enter “basic” in the text box on the left and click “Authorize APIs”. You should be taken to your website where you can authorize the request, after which you should be returned to the Playground.
-
Click “Exchange authorization code for tokens” to receive a token (you’ll need to do this within 30 seconds).
-
The response on the right should show the access token. Enter the URL of your resource page (such as https://domain.com/resource.php).
-
Add any optional parameters you want, and click “Send the request”. If you’ve used the same code as previously you should see the same response:
{"success":true,"message":"You accessed my APIs!"}