An error occurred after installing Xamarin.Auth

akiasakuraakiasakura USMember ✭✭

If introduce "Xamarin.Auth" from Nuget,
"ApplicationName, Hello, library_name" of Resource.Designer.cs disappears and an error is output. What is the solution to this?

Tagged:

Answers

  • akiasakuraakiasakura USMember ✭✭

    I changed my mindset.

    I thought about introducing only PCLCrypto necessary for encryption. However, even when PCLCrypto is installed, it can not be found in namespace. What is the countermeasure in this case?

  • akiasakuraakiasakura USMember ✭✭

    When PCLCrypto is put in PCL and each platform, PInvoke.Windows.Core etc etc can not be added to reference and will not be installed. If you install on PCL only, you will get an error "Perhaps it doesn't exist in the Mono for Android profile?" on build. What should I do?

  • akiasakuraakiasakura USMember ✭✭

    If someone else tried it. Naturally, it has been successfully installed without any problems.
    Apparently there seems to be a problem in my environment.

  • akiasakuraakiasakura USMember ✭✭

    When installing PCLCrypto in my environment, PCL has unnecessary "
    Plnvoke.BCrypt, Plnvoke.Kernel 32, Plnvoke.NCrypt, Plnvoke.Windows.Core "
    It seems that it enters. But I do not know if this is the cause.

    The project which I asked a friend to create was successfully built.

    Why only me?

  • akiasakuraakiasakura USMember ✭✭

    I made it in the following way.

    But I can not get good results. Is there any problem?

    `

    public TestFunction()
    {
            var key = WebUtility.UrlEncode(CONSUMER_SECRET);
    
            var method = "POST";
    
            var parameter = new Dictionary<string, string>();
            parameter.Add("oauth_consumer_key", CONSUMER_KEY);
            parameter.Add("oauth_callback", CALLBACK_URL);
            parameter.Add("oauth_signature_method", SIGNATURE_METHOD);
            parameter.Add("oauth_timestamp", TIMESTAMP);
            parameter.Add("oauth_nonce", NONCE);
            parameter.Add("oauth_version", VERSION);
            //KeyValueData.Add("include_entities", "TRUE");
    
            parameter.OrderBy((x) => x.Key); ;
    
            var setArray = new List<string>();
            foreach (var item in parameter)
            {
                var keyValue = item.Key + "=" + item.Value;
                setArray.Add(keyValue);
            }
    
            var combination = string.Join("&", setArray);
    
            var urlEncode = WebUtility.UrlEncode(combination);
    
            var oauth_signature = method + "&" + WebUtility.UrlEncode(REQUEST_TOKEN_URL) + "&" + urlEncode;
    
            var hmac = new HashHmacSha1();
            var hash = hmac.HashHmac(oauth_signature, key);
    
            var base64 = Convert.ToBase64String(utf8.GetBytes(hash));
    
            parameter.Add("oauth_signature", base64);
    
            var content = new FormUrlEncodedContent(parameter);
    
            var http = new HttpClient();
    
            var response = http.PostAsync(REQUEST_TOKEN_URL, content);
    
            var get = response.Result;
    
    ...
    
        public string HashHmac(string data, string key)
        {
            var mac = MacAlgorithmProvider.OpenAlgorithm(MacAlgorithm.HmacSha1);
            var keyMaterial = CryptographicBuffer.ConvertStringToBinary(key, Encoding.UTF8);
            var cryptoKey = mac.CreateKey(keyMaterial);
            var hash = CryptographicEngine.Sign(
                cryptoKey, CryptographicBuffer.ConvertStringToBinary(data, Encoding.UTF8));
            return CryptographicBuffer.EncodeToBase64String(hash);
        }
    

    `

  • akiasakuraakiasakura USMember ✭✭

    I was thinking on Twitter's OAuth 1.0 protocol, but the OAuth 2.0 protocol seemed easier.
    At such time, I saw the following page.
    http://www.thread-safe.com/2012/01/problem-with-oauth-for-authentication.html

    OAuth 2.0 may be better than OAuth 1.0.
    I have considered OpenID Connect.

    How about Xamarin.Auth?

  • akiasakuraakiasakura USMember ✭✭

    I looked for a way to use OpenID Connect from Xamarin application.

    the following page was found.
    https://www.kevindockx.com/working-with-oauth2-and-openid-connect-from-a-xamarin-forms-application-using-identityserver3/

  • akiasakuraakiasakura USMember ✭✭

    I was able to approve it for the time being at Xamarin.Auth.
    At first I felt troubled that the GetUI method was missing, but I found that I write on each platform by DependencyService and custom render instead of PCL. Of course we found the GetUI method.

    Twitter could be authorized, but google, facebook has not been created yet.

  • akiasakuraakiasakura USMember ✭✭

    I was able to approve it even on facebook.

  • akiasakuraakiasakura USMember ✭✭

    I am currently trying google. However, it can not be licensed. 403 error is output. Apparently google seems to be unauthorized because it abolished the request from WebView. How do you solve it?

  • akiasakuraakiasakura USMember ✭✭

    I put Oauth on hold in my application. Currently we are considering implementing it on the server side, but it will be for the time being. (Deep sigh) Does not an authentication method replace Oauth announced?

    goodbye!

Sign In or Register to comment.