Skip to content

Commit 8619fa7

Browse files
committed
add support for client auth methods that require client secret
1 parent 34c73c0 commit 8619fa7

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ OIDC_CLIENT_ID=
4242
OIDC_ISSUER_BASE_URL=
4343
OIDC_HTTP_TIMEOUT=15 seconds
4444

45+
### Optional OIDC Config - the values here will work for most people; however, in some cases, you may need to set the secret.
46+
OIDC_CLIENT_SECRET=
47+
OIDC_TOKEN_ENDPOINT_AUTH_METHOD=none
48+
4549
## OAuth2 Config for API access to Blink; disable if you don't use this
4650
OAUTH2_ENABLED=true
4751
OAUTH2_JWT_ALGORITHMS=RS256

middlewares/passport.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@ Issuer.discover(process.env.OIDC_ISSUER_BASE_URL)
2020

2121
client = new issuer.Client({
2222
client_id: process.env.OIDC_CLIENT_ID,
23+
client_secret: process.env.OIDC_CLIENT_SECRET || undefined, // you shouldn't need this in most cases
2324
redirect_uris: [`${process.env.BASE_URL}/auth/login/callback`],
2425
response_types: ['code'], // can't use implicit flow because #this-part-gets-stripped-away
2526
id_token_signed_response_alg: 'RS256', // since RS256 is asymmetric encryption, we can safely use
26-
token_endpoint_auth_method: 'none' // this - we can verify the token w/o having the secret key!
27+
token_endpoint_auth_method:
28+
// this - we can verify the token w/o having the secret key!
29+
process.env.OIDC_TOKEN_ENDPOINT_AUTH_METHOD || 'none'
2730
})
2831

2932
passport.use(

website/docs/2. Installation/2.1 Prerequisites.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,5 @@ The reason we are able to use the token endpoint without authenticating with the
6666

6767
And as the asymmetric signing algorithm may suggest, this means that Blink is indeed a public application [(which means a very specific thing in the OAuth2 spec)](https://auth0.com/docs/configure/applications/confidential-public-apps), not expected to hold any secrets. Therefore, you should ensure that the OIDC provider does support public applications like this.
6868

69-
~~_themoreyouknow.gif_~~
69+
**However**, in some rare cases, the OIDC provider may still require a client secret even though it supports asymmetric signing algorithms (e.g. Google Workspace). In that case, you can specify an alternate client authentication method (because remember, `none` means no secret is ever sent out) by specifying `OIDC_TOKEN_ENDPOINT_AUTH_METHOD` to something else (again, please check your provider's well-known endpoint to see which methods are supported), and specify the `OIDC_CLIENT_SECRET` environment variable.
7070
:::

0 commit comments

Comments
 (0)