M
M
mindgrow2018-03-07 13:56:43
ASP.NET
mindgrow, 2018-03-07 13:56:43

ASP.MVC Identity \ How to get information about a user who logged in through an external service?

Good afternoon!
In my ASP MVC application, I use authorization through Vkontakte. All information about the user is pulled from Vkontakte, as well as a link to his avatar.
For authorization, I use the dukenuken module.
There are no problems with getting data at the first login. The user is authorized, on the basis of it the user Identity is created. The information is stored in a database.
I want to implement the work in such a way that when logging in, the user sees his current VK avatar. But I ran into a problem that when working with HomeController, I cannot access information received through external services.
In AccountController in one of the methods there is a line that gets everything I need. But this only works on the first login and only in the AccountController.

var info = await AuthenticationManager.GetExternalLoginInfoAsync();

How do I get external authorization information on subsequent logins?
An example project can be found here https://github.com/vailukhin/TestVKAuth

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
stcmd04236, 2018-03-27
@stcmd04236

As far as I understand, you need the user's avatar to always be up-to-date? In principle, it can be implemented through action filters every time getting a picture at the user's login. But it can slow down the site.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question