stephenpstanley / flowController

Lightning (AURA) component that can be used to activate/deactivate Flow and Process Builder. Current active state and versions can be saved and restored
0 stars 0 forks source link

Issue with 302 Status Code when Accessing App Page #2

Closed RobinMaas95 closed 9 months ago

RobinMaas95 commented 9 months ago

Description: I followed the instructions and completed all the steps as mentioned. The "Authentication Status" of OAuth in the Named Credential is showing as "Authenticated as ...". However, when I try to open the App Page, I encounter an error due to a 302 status code. This code is returned by the call to the Tooling API in the "getFlows" function.

I suspect that there might not be an authentication error, as in my understanding, one should only reach the point where the 302 error is thrown after successful authentication. However, I have no idea where this error is coming from. I've kept the API version unchanged.

Steps to Reproduce:

  1. Followed the setup instructions.
  2. Verified the "Authentication Status" in the Named Credential.
  3. Attempted to open the App Page.

Expected Behavior: I expected to be able to access the App Page without encountering a 302 status code error. And a list of my flow to appear.

Actual Behavior: I encountered a 302 status code error when trying to access the App Page.

Additional Information:

Logs:

09:44:25.188 (188920987)|UNKNOWN|NamedCallout[Named Credential Id=0X...., Named Credential Name=ApexMDAPI, Endpoint=https://{company}.sandbox.lightning.force.com/services/data/v56.0/tooling/query?q=Select+Id,ActiveVersion.VersionNumber,LatestVersion.VersionNumber,DeveloperName+From+FlowDefinition+ORDER+BY+DeveloperName, Method=GET, External Credential Type=EXTERNAL, HTTP Header Authorization=Method: Bearer - Credential: f3..., Content-Type=application/json, Request Size bytes=-1, Retry on 401=True]

09:44:25.190 (190021365)|UNKNOWN|NamedCallout[Named Credential Id=0X..., Named Credential Name=ApexMDAPI, Status Code=302, Content-Type=null, Response Size bytes=0, Overall Callout Time ms=92, Connect Time ms=28

Screenshots: image

Please let me know if you need any further information to investigate this issue. Any assistance in resolving this problem would be greatly appreciated.

stephenpstanley commented 9 months ago

HTTP 302 means that the resource you are trying to access has been moved. It’s possible that a Salesforce seasonal release has changed the endpoint. Let me try installing this in a fresh org to see if I need to fix something

stephenpstanley commented 9 months ago

It looks like you have got the URL in the named credential wrong - Enhanced Domains has changed sandbox URLs I used https://{company}.sandbox.my.salesforce.com/

whereas your debug log shows you used https://{company}.sandbox.lightning.force.com/

When I used your setting I also got a 302 response

I've updated the readme to reflect the changed requirement

RobinMaas95 commented 9 months ago

It's now working like a charm! Thanks for your quick help! :)