Be sure to load the Google Identity Services JavaScript library
(`https://accounts.google.com/gsi/client`) on any web page where a user might
initiate an OAuth 2.0 authorization flow to obtain authorization codes or access
tokens. Use the following `<script>` snippet in your HTML `<head>` or `<body>`:

    <script src="https://accounts.google.com/gsi/client" async></script>

You can optimize your page's loading speed by loading the script with the
`async` attribute. If your script initializes a token client
(`google.accounts.oauth2.initTokenClient`) or code client
(`google.accounts.oauth2.initCodeClient`) immediately upon load, you can attach
an `onload` callback handler to the `<script>` tag:

    <script src="https://accounts.google.com/gsi/client" onload="initClient()" async></script>

Refer to the [Google Account Authorization JavaScript API reference](https://developers.google.com/identity/oauth2/web/reference/js-reference) for the
complete list of methods and configuration properties that the
`google.accounts.oauth2` namespace supports.

> [!NOTE]
> **Note:** The Google Identity Services library must be loaded directly from `https://accounts.google.com/gsi/client` using a `<script>` element in your web page. This ensures your integration always receives security updates and compatibility fixes. Self-hosting or bundling an offline copy of the script is not supported and may lead to unexpected failures.

## Next steps

After loading the client library, choose the authorization model that matches
your application architecture:

- [Choose a user authorization model](https://developers.google.com/identity/oauth2/web/guides/choose-authorization-model) to compare the authorization code and implicit grant flows.
- [Use the authorization code model](https://developers.google.com/identity/oauth2/web/guides/use-code-model) (recommended for apps with a backend server).
- [Use the token model](https://developers.google.com/identity/oauth2/web/guides/use-token-model) (for client-side, browser-only apps).