Last active
November 4, 2025 04:20
-
-
Save mryhryki/386ddad2d8b9816e0f04950255dca791 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .env.sh | |
| node_modules | |
| package-lock.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {clientCredentialsGrant, discovery} from 'openid-client' | |
| (async () => { | |
| const config = await discovery({ | |
| server: new URL(process.env.SERVER_ORIGIN), | |
| clientId: process.env.CLIENT_ID, | |
| clientSecret: process.env.CLIENT_SECRET, | |
| }) | |
| const tokens = await clientCredentialsGrant( | |
| config, | |
| {}, | |
| ) | |
| console.log('Token Endpoint Response', tokens) | |
| })() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "oauth2_client_credentials_test", | |
| "type": "module", | |
| "private": true, | |
| "license": "MIT", | |
| "author": "mryhryki", | |
| "scripts": { | |
| "start": "source ./.env.sh && node ./index.js" | |
| }, | |
| "dependencies": { | |
| "openid-client": "^6.8.1" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment