Skip to content

Commit

Permalink
Merge pull request #185 from DuendeSoftware/joe/fallback-to-bearer
Browse files Browse the repository at this point in the history
Fall back to bearer token type
  • Loading branch information
brockallen authored Sep 2, 2023
2 parents f892352 + 5a69060 commit 09b2c93
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Duende.Bff/Extensions/HttpContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ public static async Task<AccessTokenResult> GetManagedAccessToken(this HttpConte
new AccessTokenRetrievalError("Missing DPoP Json Web Key for DPoP token"),
{ AccessTokenType: string accessTokenType } =>
new AccessTokenRetrievalError($"Unexpected access token type: {accessTokenType} - should be one of 'DPoP' or 'Bearer'"),
{ AccessTokenType: null } =>
new AccessTokenRetrievalError("Missing access token type - should be one of 'DPoP' or 'Bearer'")
{ AccessTokenType: null } =>
// Fall back to bearer tokens when the access token type is absent.
// In some edge cases, we've seen bearer tokens not have their type specified.
// But that wouldn't be the case if you had a DPoP token.
new BearerTokenResult(token.AccessToken)
};

static async Task<ClientCredentialsToken> GetUserOrClientAccessTokenAsync(HttpContext context, UserTokenRequestParameters? userAccessTokenParameters)
Expand Down

0 comments on commit 09b2c93

Please sign in to comment.