public async Task LoginAsync()
        {
            try
            {
                var authConfig = await AuthorizationServiceConfiguration.FetchFromIssuerAsync(Uri.Parse("https://example.com"));

                AuthState authState = new AuthState(authConfig);

                AuthorizationRequest.Builder authReqBuilder = new AuthorizationRequest.Builder(authConfig,
                                                                                               "RealOneGame.Xamarin",
                                                                                               ResponseTypeValues.Code,
                                                                                               Uri.Parse("https://com.example/oauth2redirect"));
                authReqBuilder.SetScope("api1 openid profile offline_access");

                AuthorizationRequest authReq = authReqBuilder.Build();

                AuthorizationService authService = new AuthorizationService(Application.Context);

                authService.PerformAuthorizationRequest(authReq, PendingIntent.GetActivity(Application.Context, 0, new Intent(Application.Context, typeof(MyAuthCompleteActivity)), 0),
                                                        PendingIntent.GetActivity(Application.Context, 0, new Intent(Application.Context, typeof(MyAuthCanceledActivity)), 0));
            }
            catch
            {
            }
        }
        private void BuildAuthorizationRequest(AuthorizationServiceConfiguration serviceConfiguration)
        {
            AuthorizationRequest.Builder builder = new AuthorizationRequest.Builder(
                serviceConfiguration,
                Configuration.ClientId,
                ResponseTypeValues.Code,
                Uri.Parse(Configuration.LoginRedirectUri));

            builder.SetScope(string.Join(" ", Scopes));

            authorizationRequest = builder.Build();
        }
        public async Task <(bool IsSucessful, string Error)> Login(Urls.OIDCUrls urls)
        {
            var configuration = new AuthorizationServiceConfiguration(
                ToUrl(urls.Authorization),
                ToUrl(urls.Token)
                );

            var authRequestBuilder = new AuthorizationRequest.Builder(
                configuration,
                AuthConstants.ClientId,
                ResponseTypeValues.Code,
                global::Android.Net.Uri.Parse(AuthConstants.RedirectUri)
                ).SetScope(AuthConstants.Scope);

            if (AuthConstants.Scope.Contains("offline_access"))
            {
                authRequestBuilder = authRequestBuilder.SetPrompt("consent");
            }
            var authRequest = authRequestBuilder.Build();

            MicroLogger.LogDebug("Making auth request to " + configuration.AuthorizationEndpoint);
#pragma warning disable IDE0059 // Unnecessary assignment of a value
            var intent = authService.GetAuthorizationRequestIntent(authRequest);
#pragma warning restore IDE0059 // Unnecessary assignment of a value

            taskCompletitionSource = new TaskCompletionSource <AuthState>();

            authService.PerformAuthorizationRequest(
                authRequest,
                AuthActivity.CreatePostAuthorizationIntent(
                    _context,
                    authRequest),
                authService.CreateCustomTabsIntentBuilder().Build()
                );

            var state = await taskCompletitionSource.Task;
            if (state.AuthorizationException != null)
            {
                return(false, state.AuthorizationException.ErrorDescription);
            }
            else
            {
                return(true, null);
            }
        }