I'm trying to implement following scenario -
- Authorization code flow where FE will fetch the auth code and pass to BE which then will try to the token by auth code and encrypt and will save to DB.
- I need to use the saved and want to use it in daemon process, so I'm trying to keep it alive for that I'm trying to use Ob behalf of flow to get a new token before it expires.
My code looks like below -
IConfidentialClientApplication app = ConfidentialClientApplicationBuilder
.Create(clientId)
.WithClientSecret(clientSecret)
.WithAuthority(authority)
.WithRedirectUri(redirectUri)
.Build();
// pass auth code and get token
var result = await app.AcquireTokenByAuthorizationCode(scopesList, authCode).ExecuteAsync();
// Use above token to get a new token (skipping the DB save step to make it easy)
var userAssertion = new (result.AccessToken "urn:ietf:params:oauth:grant-type:jwt-bearer")
var resultOnBehalfOfUser = await app.AcquireTokenOnBehalfOf(scopesList, userAssertion).ExecuteAsync();
Issue -
Authorization flow just returns the access token and no refresh token, even when I pass scope as offile access. Is it valid for newer versions?
Authorization flow return non jwt token.
On Behalf of flow expects user assertion which then expect a JWT token, I checked with 2 other assertion type but they didn't work.
Assertion type I found in documention => /// urn:ietf:params:oauth:grant-type:saml1_1-bearerSAML 1.1 bearer token /// urn:ietf:params:oauth:grant-type:saml2-bearerSAML 2 bearer token