diff --git a/TokenGenerator/Services/Token.cs b/TokenGenerator/Services/Token.cs index 0ce7639..11d324b 100644 --- a/TokenGenerator/Services/Token.cs +++ b/TokenGenerator/Services/Token.cs @@ -49,7 +49,6 @@ public async Task GetEnterpriseToken(string env, string[] scopes, string { "client_id", Guid.NewGuid().ToString() }, { "jti", RandomString(43) }, { "consumer", GetOrgNoObject(orgNo) }, - { "urn:altinn:org", org }, { "urn:altinn:orgNumber", orgNo }, { "urn:altinn:authenticatemethod", "maskinporten" }, { "urn:altinn:authlevel", 3 }, @@ -58,6 +57,11 @@ public async Task GetEnterpriseToken(string env, string[] scopes, string { "nbf", dateTimeOffset.ToUnixTimeSeconds() }, }; + if (!string.IsNullOrEmpty(org)) + { + payload.Add("urn:altinn:org", org); + } + if (!string.IsNullOrEmpty(supplierOrgNo)) { payload.Add("supplier", GetOrgNoObject(supplierOrgNo));