MscrmTools / MscrmTools.Xrm.Connection

Provides Winforms control to connect to Microsoft Dynamics CRM deployments
GNU Lesser General Public License v3.0
23 stars 38 forks source link

Connection string with client credentials doesn't work #120

Closed Yiogi1 closed 4 years ago

Yiogi1 commented 4 years ago

Every time I try to create a new connection using AuthType=ClientSecret I get the error message below: System.NullReferenceException: Object reference not set to an instance of an object. at McTools.Xrm.Connection.ConnectionDetail.get_UseOnline()

This was actually working in older toolbox versions as I have set up some on my old laptop. I have also tried to simply use the new method of clientid and clientsecret but then I get the following error (not that the same appid and key work fine in my C# app with both connection string and WebAPI OAuth): ERROR REQUESTING Token FROM THE Authentication context - General ADAL Error No redirectUri was configured. ADAL does not provide any defaults.Unable to connect to CRM: No redirectUri was configured. ADAL does not provide any defaults. No redirectUri was configured. ADAL does not provide any defaults.Unable to Login to Dynamics CRM


MscrmTools commented 4 years ago

I will work on this soon. Moving the issue to Connection Controls repository

MscrmTools commented 4 years ago

Can you test the following connection files? just replace them in your XrmToolBox installation folder

McTools.Xrm.Connection.WinForms.zip

MscrmTools commented 4 years ago

I should have precise: the updated files should allow to store client secret (which was never the case before) and ask for client secret if not stored.

I’m not sure about the nullReferenceExceptio n since I did not reproduce the error. Could you precise what connection string tag you used?

MscrmTools commented 4 years ago

Ping @Yiogi1 in case you receive notification only if tagged

Paca commented 4 years ago

Can you test the following connection files? just replace them in your XrmToolBox installation folder

McTools.Xrm.Connection.WinForms.zip

I was having the same issue, after applying your change it's working again for me ;) Thanks for the fix.

MscrmTools commented 4 years ago

Ok, I will merge and release this update soon

Yiogi1 commented 4 years ago

Sorry for the delay in answering, was off for a few days. Connection string works now with this fix. The issue with the client id and key method still has the same problem but I'm perfectly happy the first method works. Don't need both. thanks for solving this

MscrmTools commented 4 years ago

With the client id and secret, I updated the Ui so that the password can be stored and if it’s not the code now ask for the password. Doesn’t it fix your issue?

Yiogi1 commented 4 years ago

I think I need to provide more context into this. I posted two different issues. The first one is with the "connection string" authentication method. This one works perfectly now, been using it for a week so I'm happy with it.

The second issue is when I try to use the "Client Id / Secret" method, this is the second error message I posted above. The ADAL error and redirect URI issue is still there when i try to use this method. I'm not sure if you want to dig into this further. It's fine by me if you don't, I can use connection string and get my work done.

MscrmTools commented 4 years ago

For the second issue I do want to fix this too but I was able to reproduce but not since the latest update. If you still reproduce, can you send screenshots of different steps (without sensitive info of course)?

Yiogi1 commented 4 years ago

I tried the latest version, this one works as well now. Many thanks!