Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamics CRM 365 - Invalid User Authorization The user authentication passed to the platform is not valid

Whenever I click on an opportunity to customize it

Settings - Customization - Opportunity

The window bellow opens

Invalid User Authorization The user authentication passed to the platform is not valid.

It appears that the customization window is trying to open an activity window and it should open a opportunity chart window. The only error displayed is "Invalid User Authorization The user authentication passed to the platform is not valid" and there are no errors in the debug window.

Note:

  • Opportunity Charts are the only charts with this problem. If I try and customize a company chart the problem does not occur.
  • Publishing a chart from XRMToolbox works. It is only in the customization window that the problem occurs.
  • In the production version of my site, the problem does not occur.
  • I have tried clearing my browsers cache as suggested here.

---UPDATE 1---

In response to @ConorGallagher

Is it any of the opportunity charts or just particular ones?

It is ALL opportunity charts. NONE of them will open.

Have you tried opening up developer tools and checking network to see what exactly is failing?

I have and the developer tools do not reveal any errors.

Customization page: Customization debug Chart page: Chart debug

Or using fiddler do analyse it and find out what exactly is failing?

This is all I get from fiddler when I click on a chart:

Fiddler debug

Are there any encryption settings that differ between production and dev?

Encryption settings are the same between the two.

Is the dev organization a database copy of production or a new install?

Dev organization is a copy of the production that was working prior to in place upgrade.

Does it happen when you're logged directly onto the server and try customizing charts?

It happens on PC and directly on server.

---Update 2---

In response to @ConorGallagher

I'd have expected a 401 (or some http error) someplace on the network tab in developer tools. Can you double check that tab just to see.

I would have also but everything in the network tab is a 200. Except the first one is a 302. See fiddler output bellow v.

Network tab

In response to @Pawel Gradecki

1) You should not check Developer Tools for script errors, switch the tab to "Network" and check for any HTTP errors there.

See above snapshoot to @ConorGallagher of my network window ^.

Also you did not enable HTTPS decryption on fiddler, so your log is not very meaningful, you should enable this first and then recheck fiddler

My apologies here is the fiddler output with decryption enabled: Fiddler output with decryption 1 Fiddler output with decryption 2 This is much more helpful. The page appears to not be able to find the source map (404) and then redirects to the error page (302). I'm not sure though if it redirects because it can't find the source map or because of some other error.

2) Check server Trace logs, they can show some additional info that can be used for troubleshooting

https://raw.githubusercontent.com/MasterProgrammer200/stackoverflow/master/crm/log-opportunity-user-auth.txt

4) Can you open some working chart designer (for example for account) and copy the full URL and paste it to a separate window. Do the same with Opportunity chart (copy and paste it to separate window). If it's still not working for Opportunity compare both URLs, try to play with them a little (exchange some query string parameters).

I played with the url

https://crmcanada-dev.url.com/main.aspx?appSolutionId=%7bFD140AAF-4DF4-11DD-BD17-0019B9312238%7d&extraqs=etc%3d1%26id%3d%7bA3A9EE47-5093-DE11-97D4-00155DA3B01E%7d&pagetype=vizdesigner#665349499

Companies chart

Now if I change the url to:

https://crmcanada-dev.url.com/main.aspx?appSolutionId=%7bFD140AAF-4DF4-11DD-BD17-0019B9312238%7d&extraqs=etc%3d3%26id%3d%7bA3A9EE47-5093-DE11-97D4-00155DA3B01E%7d&pagetype=vizdesigner#665349499

(Since 1 is the Company object and 3 is the opportunity object). I still get redirected to the invalid user page.

Invalid user auth

Remember to check very carefully server Trace, because it can tell you something meaningful. If you will have something there, paste it here so we can also have a look at it.

See above link ^.

One more idea that came into my mind - try to backup your organization database, restore it under different name, import it under different name (so you should have a separate organization on DEV). Sometimes there are errors during organization import that do not stop the import itself, but cause some strange behaviour of the CRM. Check if this re-imported organization has the same problem.

This would be a last resort.

like image 703
MasterProgrammer200 Avatar asked Mar 15 '17 14:03

MasterProgrammer200


1 Answers

After a week of pleading and sacrificing burnt offerings to the programming gods (aka Microsoft support) we were finally able to figure out what the problem was.

The problem was that prior to the upgrade from CRM 2016 to CRM 365 we had removed a managed solution but for some reason one of the fields in the view didn't go with it. When we upgraded to 365 the unremoved field caused an error. Upon investigation we found a exclamation mark in a circle next to the problematic field in the view creator.

To fix the problem we went through every view and removed the troublesome field which for us was new_opportunitytype. Then we used the bellow query to scan the CRM database for occurrences of new_opportunitytype and had to remove it from a form by editing the xml in the SystemFormBase table

In short, hide yo kids, hide yo wife, check yo views, but most of all Microsoft needs better error handling.

Helpful query from Microsoft Support:

/*This query searches the entire CRM database for the specified string*/

declare @TableName char(256)
declare @ColumnName char(256)
declare @FindString char(256)
declare @sql char(8000)

/*Replace X with character(s) you which to find and Y with its replacement*/
set @FindString = '[enter a guid or string or something]' 

/*select o.name, c.name from syscolumns c inner join sysobjects o
     on o.id = c.id
     where o.xtype = 'U'*/

declare T_cursor cursor for
     select o.name, c.name from sysobjects o inner join syscolumns c
           on o.id = c.id
           where o.xtype = 'U' and c.xtype in (175,239,99,231,35,167)

open T_cursor
fetch next from T_cursor into @TableName, @ColumnName
while (@@fetch_status <> -1)
     begin

     set @sql = 'if exists (select * from ' + rtrim(@TableName) + ' where ' + rtrim(@ColumnName) + ' like ''%' + rtrim(@FindString) + '%'')
           begin
           print ''Table = ' + rtrim(@TableName) + '      Column = ' + rtrim(@ColumnName) + '''
           end'

     exec(@sql)

     fetch next from T_cursor into @TableName, @ColumnName 

     end

close T_cursor

deallocate T_cursor
like image 63
MasterProgrammer200 Avatar answered Nov 12 '22 18:11

MasterProgrammer200