Hi, I would like to use the WebApi Method expose by Swagger; There are a core Method Account\Authenticate to get a token.
How is it possible to use the Impersonate mecanism with WebApi ? In my business case, i have a user : UserName, Password as host user with goods rights, and a UserId and TenantId.
How can i get a token to consume the Api API with these 4 informations.
I'm using ABP 3.4.0 with a Aspnetzero MVC Project
Thanks Oliver :)
1 Answer(s)
-
0
Hi,
Check the impersonation flow from your website and try to implement the same.
Request URL => <a class="postlink" href="http://localhost:62114/Account/Impersonate">http://localhost:62114/Account/Impersonate</a> Method: => Post Post Data: => {"tenantId":24,"userId":36}
As a response you'll get an impersonation link. see the below response
result: null targetUrl: http://localhost:62114/Account/ImpersonateSignIn?tokenId=ac28201e-2406-418a-94dc-97750f609f8c success: true error: null unAuthorizedRequest: false __abp: true
Then make a GET request to this link <a class="postlink" href="http://localhost:62114/Account/ImpersonateSignIn?tokenId=ac28201e-2406-418a-94dc-97750f609f8c">http://localhost:62114/Account/Imperson ... 750f609f8c</a>
[attachment=0:2q70nhbg]impersonate-web-api.jpg[/attachment:2q70nhbg]