The Coil OAuth API is primarily used for sites that have already taken the step to set up Web Monetization and want to offer a way for Coil Members to access monetized content on mobile and on desktop without the Coil Extension installed.
If you're already familiar with Web Monetization, read about our OAuth Web Monetization Script. The script is available for any site that uses Coil's OAuth and allows users to sign in to their Coil account from your site.
Before you can use the API, you must register your client app and be approved for OAuth access.
After you've submitted the registration form, you must email email@example.com and let us know. Coil will review your request and, if approved, send you a registration access token. You must then use the access token to register your app with the Coil OpenID Connect (OIDC) provider. The registration process is outlined on the POST /oauth/reg page.
The Coil OIDC and OAuth2 provider uses the
oidc-provider package, which implements the specs described by openid.net.
Openid-configuration is the Coil OIDC provider's discovery document. The document describes the API endpoints used during the authentication sequence. You'll need these details to construct requests to the server. Specifying this URL connects the authenticator to the OIDC provider.
The Coil OIDC and OAuth2 provider uses the authorization code flow to grant access to resources (such as profile information) owned by Coil users.
Register your client app with Coil to receive a registration access token.
Register your app with the Coil OIDC provider to exchange the registration access token for a client ID and client secret.
Get permission for your app to access resources owned by a Coil user.
Request an access token.
Get the resources that the app was previously granted access to.
Issue the Coil user a BTP token.