Stefan
Stefan

Reputation: 134

Parsing an oauth token in my own code

I have an application (WPF C#, asp.net web api 2 on the server) where the user logs in, and may login as an administrator. And then I want them to be able to logout, and the login as another user but still complete some administrative tasks. For that I thought the easiest way to do it would be to pass through to my Web API function on the server the oauth token returned when loggged in as the administrator. Then I should be able to read the token, verify that it is valid and check that the user is an administrator.

However, I can't find any obvious way that I can do this.

Is there any easy way that I can do this?

Upvotes: 1

Views: 1212

Answers (1)

Stefan
Stefan

Reputation: 134

The answer to this is VERY easy, here's what you need to do: Startup.OAuthOptions.AccessTokenFormat.Unprotect(adminToken);

Where Startup is the default MVC class containing ConfigureAuth.

Upvotes: 3

Related Questions