# Oauth2 providers

ShipClojure provides [OAuth2 support](https://www.oauth.com/) for any login providers. By default, the Google provider is already setup.

## Setting up Google login

Follow the steps [here](https://www.oauth.com/oauth2-servers/signing-in-with-google/create-an-application/) to create a google application and get your `client-id` & `client-secret`.

> *Important*: Make sure the redirect URI set-up in your application matches the format `/oauth2/:provider/callback` which is the default for shipclojure

Add these properties to `~/.saas-secrets.edn` under `[:oauth2-providers :google]` `{:client-id "123" :client-secret" "123"}`

That's it! Your google login should be ready

## Adding a new OAuth2 Provider

1. Add the new entry in [system.edn](https://github.com/shipclojure/shipclojure/blob/main/resources/system.edn) under `:oauth2/providers`
2. Add the client secrets (`:client-id` & `:client-secret`) in your `resources/.{prod|dev}-secrets.edn` file

   ```edn
   {:oauth2-providers
    {:google {:client-id "public client id"
              :client-secret "client secret"}
     :new-provider {:client-id "public client id"
                    :client-secret "secret shhh!"}}}
   ```
3. Test your connection by visiting `/oauth2/:provider` and if everything was setup correctly, your new provider should work


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://shipclojure.gitbook.io/shipclojure-docs/auth/oauth2-providers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
