Implementing IAM in revit plugins

Implementing IAM in revit plugins

c.bourget
Participant Participant
372 Views
0 Replies
Message 1 of 1

Implementing IAM in revit plugins

c.bourget
Participant
Participant

Hello everyone !

We are actualy develloping an IAM (duende) for our Revit's plugins.

It's works nicely with a simple WPFTest project.

When we put our authenticate library to Revit addin we got this error :

 System.InvalidOperationException: Error loading discovery document: Issuer name is missing

We Compare revit addin and wpf hot data, we got 2 miss:

-httpClientFactory

-StateLenght

We supposed it's a loadless package cause of revit...

Have you any suggest ?

 

Revit v2021

.Net Framework v4.8

Duende v5

IdentityModel v5.1

IdentityModel.OidcClientv4

 

Code :

 

public async void Start(object sender, RoutedEventArgs e)
        {
            OidcClientOptions options = new OidcClientOptions()
            {
                Authority = "https://localhost:5001",
                ClientId = "test",
                ClientSecret = "test",
                Scope = "openid profile email roles",
                RedirectUri = "http://127.0.0.1/sample-wpf-app",
                Browser = new WpfEmbeddedBrowser()
            };
            
            _oidcClient = new OidcClient(options);
        
            LoginResult result;
            try
            {
                //Fail here, in the prepare
                AuthorizeState authorizeState = await _oidcClient.PrepareLoginAsync();
                result = await _oidcClient.LoginAsync();
            }
            catch (Exception ex)
            {
                Message.Text = $"Unexpected Error: {ex.Message}";
                return;
            }
        
            if (result.IsError)
            {
                Message.Text = result.Error == "UserCancel" ? "The sign-in window was closed before authorization was completed." : result.Error;
            }
            else
            {
                string name = result.User.Claims.FirstOrDefault(x => x.Type.Equals("sub", StringComparison.OrdinalIgnoreCase))
                    ?.Value;
                Message.Text = $"Hello {name}";
            }
        }

 

 

Thank you ! 

0 Likes
373 Views
0 Replies
Replies (0)