I have then added a client and a user in my database and i'm trying to use postman to connect however i'm getting the following error:
Error: secretOrPrivateKey must have a value
at Object.module.exports [as sign] (/auth-api/node_modules/jsonwebtoken/sign.js:107:20)
at /auth-api/node_modules/@jmondi/oauth2-server/src/utils/jwt.ts:36:11
at new Promise (<anonymous>)
at JwtService.sign (/auth-api/node_modules/@jmondi/oauth2-server/src/utils/jwt.ts:35:12)
at AuthCodeGrant.encrypt (/auth-api/node_modules/@jmondi/oauth2-server/src/grants/abstract/abstract.grant.ts:258:21)
at AuthCodeGrant.completeAuthorizationRequest (/auth-api/node_modules/@jmondi/oauth2-server/src/grants/auth_code.grant.ts:213:29)
at AuthorizationServer.completeAuthorizationRequest (/auth-api/node_modules/@jmondi/oauth2-server/src/authorization_server.ts:125:12)
[ERROR] 16:35:46 Error: secretOrPrivateKey must have a value
I have tried as a normal postman request and also using the OAuth function in authorization.
{
"info": {
"_postman_id": "ca96c9f8-5d76-43c8-beec-5b8aa6c76289",
"name": "auth-api",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "index",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}",
"host": [
"{{base_url}}"
]
}
},
"response": []
},
{
"name": "authorize",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/authorize?response_type=code&client_id=f9e3bd26-703a-4133-8eb2-05a2a5ae36d2&redirect_uri=http://localhost:4000&state=123456789&code_challenge=92d3b56942866d1edf02c33339b7c3dc37c6201282bb238cb47f0d3289f28a93f1bdd8af6ca9913aed0c4c&code_challenge_method=S256",
"host": [
"{{base_url}}"
],
"path": [
"authorize"
],
"query": [
{
"key": "response_type",
"value": "code"
},
{
"key": "client_id",
"value": "f9e3bd26-703a-4133-8eb2-05a2a5ae36d2"
},
{
"key": "redirect_uri",
"value": "http://localhost:4000"
},
{
"key": "state",
"value": "123456789"
},
{
"key": "code_challenge",
"value": "92d3b56942866d1edf02c33339b7c3dc37c6201282bb238cb47f0d3289f28a93f1bdd8af6ca9913aed0c4c"
},
{
"key": "code_challenge_method",
"value": "S256"
}
]
}
},
"response": []
},
{
"name": "authorize-auth-code",
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "scope",
"value": "code",
"type": "string"
},
{
"key": "accessTokenUrl",
"value": "http://{{base_url}}/authorize",
"type": "string"
},
{
"key": "useBrowser",
"value": false,
"type": "boolean"
},
{
"key": "grant_type",
"value": "authorization_code_with_pkce",
"type": "string"
},
{
"key": "authUrl",
"value": "http://{{base_url}}/authorize",
"type": "string"
},
{
"key": "redirect_uri",
"value": "http://localhost:4000",
"type": "string"
},
{
"key": "clientSecret",
"value": "123456",
"type": "string"
},
{
"key": "clientId",
"value": "f9e3bd26-703a-4133-8eb2-05a2a5ae36d2",
"type": "string"
},
{
"key": "state",
"value": "123456789",
"type": "string"
},
{
"key": "addTokenTo",
"value": "header",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/authorize",
"host": [
"{{base_url}}"
],
"path": [
"authorize"
]
}
},
"response": []
}
]
}