Documentation ¶
Overview ¶
The example program shows how to use the auth package.
Before usage, credentials needs to be created. Go to the https://console.cloud.google.com/apis/credentials page and create an "OAuth 2.0 Client ID". The OAuth 2.0 client ID and secret should be passed using the 'client-id' and 'client-secret' flags. In the client ID configuration, the "Authorized Javascript origins" should contain http://localhost:8080 (or another URL address that this server is running at). And the "Authorized redirect URIs" should contain the same address with a "/auth" suffix - according to where the `auth.RedirectHandler()` is mounted in this code, and see that `auth.Config.OAuth2.RedirectURL` is configured accordingly.