wrobins / cordova-plugin-msal

Use the newest Microsoft MSAL library in your Cordova-based project!
Apache License 2.0
23 stars 63 forks source link

signInSilent/signInInteractive returning only token, not the response as documented #90

Open jdipallo opened 2 years ago

jdipallo commented 2 years ago

Hello:

Your documentation is very clear regarding the Response we should expect from successful calls to both signIn[Silent|Interactively]: { token: 'eyJ0eXAiOiJKV1QiLCJub...', account: { id: 'abc-someguid-123', username: 'wrobins@myemailaddr.com', claims: [ {key: "name", value: "Robins, Walter"}, {key: "ver", value: "2.0"}, { ... } ] } }

However, I am only seeing the token (what appears to be a token anyway). Not an JSON object.

Can you please assist?

Thank you

jdipallo commented 2 years ago

@wrobins if possible, can you please help on this? Thank you.

Horbee commented 2 years ago

@jdipallo The same thing happens to me as well. I am not sure if it is still helpful for you, but I tried to do something similar as a workaround:

window.cordova.plugins.msalPlugin.signInInteractive(
      function (token) {
        // Success callback
        axios
          .get("https://graph.microsoft.com/v1.0/me", {
            headers: {
              Authorization: `Bearer ${token}`,
            },
          })
          .then((resp) => {
            console.log("USER:", JSON.stringify(resp.data));
          })
      },
      function (err) { .... }
    );
jdipallo commented 2 years ago

@Horbee: yes, that is what I implemented. Works fine, just an extra call. I see in the Alpha version of this plug-in, this is seems resolved. Although, it's been in alpha for quite a while. Thank you.