Login with CodePinion (OAuth)
Let people sign in to your own app with their CodePinion account, using OAuth 2.0 and OpenID Connect.
CodePinion is an OAuth 2.0 and OpenID Connect provider. Your own web app can offer Login with CodePinion the way sites offer sign-in with Google, using any standard OpenID Connect library.
It is for identity only: your app learns who the person is, not access to their CodePinion repositories or data.
Register your app
- Open Settings → OAuth Apps (/settings/developer (requires sign-in)) and choose New app.
- Give it a name, its redirect URIs, and optionally a homepage and a logo. For the logo, upload a PNG, JPEG, WebP or GIF up to 2 MB, or give the address of an image. An upload is used over an address, and with neither, people see your app's initial.
- Copy the client ID and client secret. The secret is shown once; if you lose it, regenerate it, which stops the old one working.
Rules for redirect URIs:
- They must use
https://.http://localhostandhttp://127.0.0.1are allowed for local development. - They are matched exactly. No wildcards, prefixes or subdomains.
You can register up to 10 apps. Deleting an app revokes every token it was issued.
Endpoints
Most libraries only need the discovery document; the rest is listed for completeness.
| Address | |
|---|---|
| Discovery | https://api.codepinion.co.ke/oauth/.well-known/openid-configuration |
| Issuer | https://api.codepinion.co.ke/oauth |
| Authorize | https://api.codepinion.co.ke/oauth/authorize/ |
| Token | https://api.codepinion.co.ke/oauth/token/ |
| User info | https://api.codepinion.co.ke/oauth/userinfo/ |
| Revoke | https://api.codepinion.co.ke/oauth/revoke_token/ |
| Signing keys (JWKS) | https://api.codepinion.co.ke/oauth/.well-known/jwks.json |
The flow
CodePinion supports the authorization code flow with PKCE, which is required for every app, including server-side ones with a secret.
- Send the person to the authorize endpoint with your
client_id, a registeredredirect_uri,response_type=code, thescope, astate, and a PKCEcode_challenge(S256). - They sign in to CodePinion if needed, and see a consent screen naming your app and what it asks for.
- CodePinion redirects back to you with
codeandstate(orerrorif they declined). - Your server exchanges the code at the token endpoint, with the
code_verifier, for an ID token, an access token and a refresh token.
curl -X POST https://api.codepinion.co.ke/oauth/token/ \
-d grant_type=authorization_code \
-d code="$CODE" \
-d redirect_uri=https://yourapp.example/callback \
-d client_id="$CLIENT_ID" \
-d client_secret="$CLIENT_SECRET" \
-d code_verifier="$CODE_VERIFIER"
Scopes and claims
| Scope | Claims |
|---|---|
openid | sub: the person's CodePinion user ID. Required. |
profile | name, picture, preferred_username (their public handle when they have one). |
email | email, and email_verified, which is always true: every CodePinion sign-in proves the address with an emailed code. |
Token lifetimes
| Token | Lasts |
|---|---|
| Authorization code | 5 minutes, single use. |
| Access token | 1 hour. |
| ID token | 1 hour. |
| Refresh token | 30 days. Each use returns a new one and retires the old; reusing a retired one is detected. |
Consent
People see the consent screen the first time they sign in to your app, and again whenever you ask for more scopes than they have already granted. A consent request that isn't answered expires after 10 minutes.
The first time someone authorizes your app, CodePinion emails them, with a link to revoke it. They can see and revoke every app under Connected apps (requires sign-in); revoking removes only their own tokens.