Sp-dev-fx-webparts: react-aad-implicitflow auto-login adal

Created on 8 May 2017  路  9Comments  路  Source: pnp/sp-dev-fx-webparts

  • [ X ] Question

Hey,

just wondering if anyone made a solution where the user does not have to "log in" or press "connect" as in this sample, to be able to utilize adal?

The user doesnt seem to be caches, I guess this is because we want a "webpart-specific" authenticationcontext?

If anyone could point me in the right direction I would appreciate it :)

/Simon

Most helpful comment

You're right, that it shouldn't be necessary, but that's unfortunately the current state of things. Hopefully we will see it changed in the future.

All 9 comments

Would you like to access the Microsoft Graph or a custom API secured with AAD?

I would like to access the Microsoft Graph, and I'm playing around with the PowerBI API aswell.
And just to be clear, everything works in terms of getting data from the graph etc.
Just the login-part that Im cocerned with :)

Gotcha. There is another way to access resources secured with AAD, but it doesn't offer you an access token, which is why I asked what you are trying to access.

Theoretically you could start the authentication flow automatically. Imagine however, that as a user, you come to the page with such web part, and without doing anything, you're presented with a login popup or being redirected to the AAD sign in page. If that's acceptable for your scenario, then you could definitely do it.

Yeah I dont know.
For instance I would like to have a webpart that presents the current users groups.
From my understanding this endpoint is one way: "https://graph.microsoft.com/v1.0/me/memberOf".

But while logged in i SharePoint online it seems a bit "unnecessary" to login in again just to see my groups.

Thanks for the answers!

You're right, that it shouldn't be necessary, but that's unfortunately the current state of things. Hopefully we will see it changed in the future.

Hi waldekmastykarz,
I need implement this: https://developer.microsoft.com/en-us/graph/docs/concepts/auth_v2_service
For this I need get token without login, but acquireToken require login. In node.js, for example there is an function acquireTokenWithClientCredentials where I can send client_secret. There are this in angular-adal?
Thank in advance.

@leilaferradas You can only do implicit flow from the client... you can't use client creds client side, only server side.

Hi Andrew,
And, in this example "implicit flow" How can I login automatically, without the user press the login button?
Thanks

Was this page helpful?
0 / 5 - 0 ratings