Receiving 401 error code when trying to access Blockchain workbench api

alex man 1 Reputation point
2020-07-11T09:28:06.86+00:00

Receiving 401 error code when trying to access Blockchain workbench api but when I use same token to access graph api , it functions properly.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
39,810 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Aishik Pyne 6 Reputation points
    2020-07-20T10:19:41.373+00:00

    Hi @alexman-8196

    To understand your problem in detail I have a few questions

    1. What is the intention of authentication? Are you trying to use the workbench API directly without the UI?
    2. How are you obtaining the token? Against a user who is a part of the AAD or a SPN?

    Just of debugging can you open the workbench UI, go to the networks tab, open an XHR request to the API web app and copy the authorization token from the header and use it in your application? This would help us understand if the issue as to why your token is giving a 401 error?


  2. alex man 1 Reputation point
    2020-07-29T01:36:06.163+00:00

    I have configured the following, but aud value is not equal to app value

    passport.use(new OIDCStrategy(
    {
    identityMetadata: 'https://login.microsoftonline.com/tenantid/v2.0/.well-known/openid-configuration',
    clientID: process.env.OAUTH_APP_ID,
    audience: process.env.OAUTH_APP_ID,
    responseType: 'code id_token',
    responseMode: 'form_post',
    redirectUrl: process.env.OAUTH_REDIRECT_URI,
    allowHttpForRedirectUrl: true,
    clientSecret: process.env.OAUTH_APP_PASSWORD,
    validateIssuer: false,
    passReqToCallback: false,
    scope: process.env.OAUTH_SCOPES.split(' ')
    }

    But aud field is 00000003-0000-0000-c000-000000000000 (not equal to app id)

    payload contains iss: "https://sts.windows.net/tentantId/"

    On sigin activity page,

    Resource
    Microsoft Graph

    Resource ID
    00000003-0000-0000-c000-000000000000

    Token issuer type
    Azure AD

    Token issuer name
    null


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.