question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to authenticate to API & access to-do list function of application

See original GitHub issue

I am having issues starting the sample application and accessing the To Do List section of the app.

The error I receive is - We’re having trouble signing you in. Error. Status code = InternalServerError

I am able to login to the application successfully, but not able to access the to do list function. I think the issue stems from the PublishedScopes. In the documentation, it does not tell which scopes should be created in the API to the web app, and there are no default values. I created values ‘read’,‘write’,‘user_impersonation’ and granted the web app access but this did not resolve my issue.

TaskService web.config

<appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="ida:AadInstance" value="https://login.microsoftonline.com/{0}/v2.0/.well-known/openid-configuration?p={1}" />
    <add key="ida:Tenant" value="montelb2c.onmicrosoft.com" />
    <add key="ida:ClientId" value="0340d8fc-1c37-4bc5-818c-28acfef6feee" />
    <add key="ida:SignUpSignInPolicyId" value="B2C_1A_signup_signinwithAAD" />

    <!-- The following settings is used for requesting access tokens -->
    <add key="api:ReadScope" value="read" />
    <add key="api:WriteScope" value="write" />
  </appSettings>

TaskWebApp web.config.

<appSettings>
 <add key="webpages:Version" value="3.0.0.0" />
 <add key="webpages:Enabled" value="false" />
 <add key="ClientValidationEnabled" value="true" />
 <add key="UnobtrusiveJavaScriptEnabled" value="true" />
 <add key="ida:Tenant" value="montelb2c.onmicrosoft.com" />
 <add key="ida:ClientId" value="b4b2384b-457d-4fa6-a9ff-953f1834be8e" />
 <add key="ida:ClientSecret" value="hidden" />
 <add key="ida:AadInstance" value="https://login.microsoftonline.com/tfp/{0}/{1}/v2.0/.well-known/openid-configuration" />
 <add key="ida:RedirectUri" value="https://localhost:44316/" />
 
 <add key="ida:SignUpSignInPolicyId" value="B2C_1A_signup_signinwithAAD" />
 <add key="ida:EditProfilePolicyId" value="B2C_1A_ProfileEdit" />
 <add key="ida:ResetPasswordPolicyId" value="B2C_1A_PasswordReset" />
 
 <!-- Uncomment the localhost url if you want to run the API locally -->
 <!--add key="api:TaskServiceUrl" value="https://aadb2cplayground.azurewebsites.net/" /-->
 <add key="api:TaskServiceUrl" value="https://localhost:44332/" />

 <!-- The following settings is used for requesting access tokens -->
 <add key="api:ApiIdentifier" value="https://montelb2c.onmicrosoft.com/tasks" />
 <add key="api:ReadScope" value="read" />
 <add key="api:WriteScope" value="write" />
 
</appSettings>

Please assist!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
benphuntercommented, Feb 2, 2021

I also had the same issue and realised that I had made a mistake when reading the instructions. I granted API permissions in the webapi not the webapp application. I need to pay more attention, hopefully this will help someone else.

0reactions
jmprieurcommented, Nov 5, 2021

Thanks for the heads-up and for helping cleaning-up @aremo-ms

Read more comments on GitHub >

github_iconTop Results From Across the Web

OAuth2: Unable to Authenticate API request - Stack Overflow
Been tasked to export forms and items from Podio using the API. Trying to do this with straight Python and Requests instead of...
Read more >
Azure Function App w/ 0Auth error - ERROR: AADSTS500011
This error usually comes when application has not been configured properly. Make sure you are following below to request the token: -Register ...
Read more >
REST API seems to require Interactive Login - this fails for web ...
The problem arises when trying to do REST API calls from a web application. (example: web app periodically synchronizes MySQL database on PHP ......
Read more >
How can I authenticate API requests? - Zendesk help
I want to show some of the Zendesk content on my own web app platform without having to proxy the requests to Zendesk...
Read more >
Using OAuth 2.0 to Access Google APIs | Authorization
Google APIs use the OAuth 2.0 protocol for authentication and ... Disable any features of your app unable to function without access to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found