Home Unable to Login with Microsoft Account Services in Website razor. stil NOT WORKING
Reply: 0

Unable to Login with Microsoft Account Services in Website razor. stil NOT WORKING

user2878 Published in April 22, 2018, 4:53 am

I just have simple question!

I'm currently stack with my website. I have create a new ASP.NET Website Razor(v3). And I would like to Integrate the Microsoft user authentication to it. please note: This project is not an MVC project But Razor page Website! In other word: How to add OAuth and openID using Razor Website

Web Purpose: Is to allow user to login using their Microsoft Account.

I have the Client ID and the Secret key but still failing. I first remove the comment RegisterMicrosoftClient Option and I have put my ID and key:


and I create 2 Classes: 1. AuthConfig

public static class AuthConfig
    public static void RegisterAuth()
        OAuthWebSecurity.RegisterClient(new MyOAuthClient("XXXXXXXXXXXXX", "smS078(*XXXXXXXXXXXXXXX"), "MyWebApp", null);

2. MyOAuthClient

public class MyOAuthClient : OAuthClient
        public static readonly ServiceProviderDescription MyServiceDescription = new ServiceProviderDescription
            RequestTokenEndpoint = new MessageReceivingEndpoint("https:sampleapiendpoint", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
            UserAuthorizationEndpoint = new MessageReceivingEndpoint("https://sampleapiauthorizationendpoint", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
            AccessTokenEndpoint = new MessageReceivingEndpoint("https://sampleapiaccesstokenendpoint", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
            TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new PlaintextSigningBindingElement() }

        public MyOAuthClient(string consumerKey, string consumerSecret) :
            this(consumerKey, consumerSecret, new AuthenticationOnlyCookieOAuthTokenManager())

        public MyOAuthClient(string consumerKey, string consumerSecret, IOAuthTokenManager tokenManager) :
            base("dropbox", MyServiceDescription, new SimpleConsumerTokenManager(consumerKey, consumerSecret, tokenManager))

        protected override DotNetOpenAuth.AspNet.AuthenticationResult VerifyAuthenticationCore(DotNetOpenAuth.OAuth.Messages.AuthorizedTokenResponse response)
            //Perform the verification process
            return new AuthenticationResult(true);

According to the CodeGuru instruction: LINK


Please Anyone Help is much appreciated!!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.306766 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO