Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Can't call MS Graph using Azure B2C app id #325

Closed
Ronkiro opened this issue Oct 19, 2023 · 1 comment
Closed

Can't call MS Graph using Azure B2C app id #325

Ronkiro opened this issue Oct 19, 2023 · 1 comment

Comments

@Ronkiro
Copy link

Ronkiro commented Oct 19, 2023

Issue

When trying to follow https://github.com/Azure-Samples/ms-identity-javascript-angular-tutorial/tree/main/2-Authorization-I/1-call-graph or use it's code, acquiring token returns no access token. Because of that, all subsequent logic fails.

I found many resources talking about Azure and Azure B2C and now i'm completely lost on what should i do. I just want to somehow invite users to use a platform manually and allow them to sign in my plataform (and retrieve their info, for this i'm trying to use User.Read permissions for MS Graph).

The sample doesn't works and it also says that AADB2C90117: The scope 'user.read' provided in the request is not supported.. I have solved this by using https://graph.microsoft.com/User.Read instead, who solved the error (but may be the reason behind not being able to retrieve the token).

This issue is for the sample

    - [ ] 1-1) Sign-in with Azure AD
    - [ ] 1-2) Sign-in with Azure AD B2C
    - [x] 2-1) Acquire a Token and call Microsoft Graph
    - [ ] 3-1) Protect and call a web API on Azure AD
    - [ ] 3-2) Protect and call a web API on Azure AD B2C
    - [ ]   4) Deploy to Azure Storage and App Service
    - [ ] 5-1) Call a web API using App Roles
    - [ ] 5-2) Call a web API using Security Groups
    - [ ] 6-1) Call Microsoft Graph using on-behalf-of flow
    - [ ] 6-2) Call a multi-tenant web API

This issue is for a

    - [ ] bug report -> please search issues before submitting
    - [x] question
    - [ ] feature request
    - [ ] documentation issue or request

Minimal steps to reproduce

  1. Clone the sample
  2. Change the app id for one created from Azure B2C
  3. Try running the sample (It fails to acquire token)

Any log messages given by the failure

It shows no error

[Thu, 19 Oct 2023 14:01:24 GMT] : [] : @azure/msal-browser@3.2.0 : Info - Emitting event: msal:popupOpened
auth-config.ts:65 [Thu, 19 Oct 2023 14:01:25 GMT] : [] : @azure/msal-common@14.1.0 : Info - CacheManager:getIdToken - Returning id token
auth-config.ts:65 [Thu, 19 Oct 2023 14:01:25 GMT] : [] : @azure/msal-browser@3.2.0 : Info - Emitting event: msal:acquireTokenSuccess
app.component.ts:73 {eventType: 'msal:acquireTokenSuccess', interactionType: 'popup', payload: {…}, error: null, timestamp: 1697724085280}error: nulleventType: "msal:acquireTokenSuccess"interactionType: "popup"payload: accessToken: ""account: {homeAccountId: 'd666c0e7-1697-41e5-8319-ef03d4764fad-b2c_1_thinkdub_signin.f4449dcb-2508-4ada-83ed-0ba2f5b48fa7', environment: 'thinkdub.b2clogin.com', tenantId: '', username: 'alexander.diniz@thinkaigroup.com', localAccountId: 'd666c0e7-1697-41e5-8319-ef03d4764fad', …}authority: "https://thinkdub.b2clogin.com/thinkdub.onmicrosoft.com/b2c_1_thinkdub_signin/"cloudGraphHostName: ""code: undefinedcorrelationId: "5387012a-f66c-409c-a9ea-a0410ec91406"expiresOn: nullextExpiresOn: undefinedfamilyId: ""fromCache: falsefromNativeBroker: falseidToken: "eyJhbGciOiJSUzI1NiIsImtpZCI6Ilg1ZVhrNHh5b2pORnVtMWtsMll0djhkbE5QNC1jNTdkTzZRR1RWQndhTmsiLCJ0eXAiOiJKV1QifQ.eyJ2ZXIiOiIxLjAiLCJpc3MiOiJodHRwczovL3RoaW5rZHViLmIyY2xvZ2luLmNvbS9mNDQ0OWRjYi0yNTA4LTRhZGEtODNlZC0wYmEyZjViNDhmYTcvdjIuMC8iLCJzdWIiOiJkNjY2YzBlNy0xNjk3LTQxZTUtODMxOS1lZjAzZDQ3NjRmYWQiLCJhdWQiOiJjYzYzZjI5YS01OWFjLTQ2NTMtODZiNS1mMWUyNjFjOTA2MTQiLCJleHAiOjE2OTc3Mjc2ODUsIm5vbmNlIjoiOGUxMTJiNDYtOTFlNS00ZDYwLTg2NjItZDE4NDYzM2IxZWQyIiwiaWF0IjoxNjk3NzI0MDg1LCJhdXRoX3RpbWUiOjE2OTc3MjQwODQsIm9pZCI6ImQ2NjZjMGU3LTE2OTctNDFlNS04MzE5LWVmMDNkNDc2NGZhZCIsIm5hbWUiOiJBbGV4YW5kZXIgRGluaXoiLCJnaXZlbl9uYW1lIjoiQWxleGFuZGVyIiwiZmFtaWx5X25hbWUiOiJEaW5peiIsImVtYWlscyI6WyJhbGV4YW5kZXIuZGluaXpAdGhpbmthaWdyb3VwLmNvbSJdLCJ0ZnAiOiJCMkNfMV90aGlua2R1Yl9zaWduaW4iLCJuYmYiOjE2OTc3MjQwODV9.TWdtvfyddkFaqNzM-yQwVqrZldNZiIhHEZvrBmaxita97SQ-FzjQ5CEocA2rOdQNXYoW_9vykETk-woQ2QdHMqNi2KcnQ9GhQcYNJnAceu978fMnpjaNQrOdrt60_BqYuD1dbnaW_j_HebIZGGcojYF8R8TNIWt0CJ8FofupReQSKOKprhYV8gWY8FkU3-eaVNw1ev02UmKbpnUxfSj3NSYOomuPB7dJbZuA2OVYcWw6J95d7Brdc1jNJxUNJQaUHNJd_00gjok1XjDbZjAl1Iy-tMV0CFbJImN8F2rakHmFNvF5PpXEc-R21g1K2Z0U8Jf-PPk_Gv4Nio8EmdjUGA"idTokenClaims: {ver: '1.0', iss: 'https://thinkdub.b2clogin.com/f4449dcb-2508-4ada-83ed-0ba2f5b48fa7/v2.0/', sub: 'd666c0e7-1697-41e5-8319-ef03d4764fad', aud: 'cc63f29a-59ac-4653-86b5-f1e261c90614', exp: 1697727685, …}msGraphHost: ""refreshOn: undefinedrequestId: ""scopes: []state: ""tenantId: ""tokenType: ""uniqueId: "d666c0e7-1697-41e5-8319-ef03d4764fad"[[Prototype]]: Objecttimestamp: 1697724085280[[Prototype]]: Object
auth-config.ts:65 [Thu, 19 Oct 2023 14:01:25 GMT] : [] : @azure/msal-common@14.1.0 : Info - CacheManager:getIdToken - Returning id token
auth-config.ts:65 [Thu, 19 Oct 2023 14:01:25 GMT] : [] : @azure/msal-common@14.1.0 : Info - CacheManager:getIdToken - Returning id token
auth-config.ts:65 [Thu, 19 Oct 2023 14:01:25 GMT] : [] : @azure/msal-common@14.1.0 : Info - CacheManager:getIdToken - Returning id token
auth-config.ts:65 [Thu, 19 Oct 2023 14:01:25 GMT] : [] : @azure/msal-common@14.1.0 : Info - CacheManager:getIdToken - Returning id token

Expected/desired behavior

It should return an access token

Library version

The same for the sample

Browser and version

Chrome Version118.0.5993.70 (Official) 64 bits

@Ronkiro
Copy link
Author

Ronkiro commented Oct 19, 2023

Closing as i managed to using creation scripts

@Ronkiro Ronkiro closed this as completed Oct 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant