<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: OAuth 2.0 Invalid Redirect URI in ArcGIS Online Developers Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-developers-questions/oauth-2-0-invalid-redirect-uri/m-p/1221835#M1164</link>
    <description>&lt;P&gt;Well as embarrassing as this is... I discovered the Client Id was incorrect.&amp;nbsp; Leaving up as a reminder to check Client Id if you run into this error.&lt;/P&gt;</description>
    <pubDate>Thu, 13 Oct 2022 22:04:59 GMT</pubDate>
    <dc:creator>DaltonR121</dc:creator>
    <dc:date>2022-10-13T22:04:59Z</dc:date>
    <item>
      <title>OAuth 2.0 Invalid Redirect URI</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/oauth-2-0-invalid-redirect-uri/m-p/1221707#M1163</link>
      <description>&lt;P&gt;I'm currently experiencing a problem implementing OAuth 2.0.&amp;nbsp; The application is written in HTML, CSS, and plain JavaScript but here's where it may get interesting... The code is then placed within a single Media Content Web Part within Sharepoint.&amp;nbsp; I don't believe a lot of the Sharepoint integration materials are relevant to my particular set up since ArcGIS isn't within its own webpart - it's just coded within the JavaScript and placed on the page within a viewDiv.&lt;BR /&gt;&lt;BR /&gt;I have referenced &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/identity-oauth-basic/" target="_blank" rel="noopener"&gt;this specific documentation page&lt;/A&gt;&amp;nbsp;probably 100 times and believe I have followed all of the steps exactly.&amp;nbsp; I have also gone within my Developer Dashboard, registered the application, and tucked my site's URL within the "Redirect URLs" trying multiple ways including with trailing slashes and without.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RedirectURIs.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/53583i52C40867731F5CD6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RedirectURIs.png" alt="RedirectURIs.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DaltonR121_0-1665685611330.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/53584i8AEDD445D39D1D3F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DaltonR121_0-1665685611330.png" alt="DaltonR121_0-1665685611330.png" /&gt;&lt;/span&gt; &lt;/P&gt;&lt;P&gt;I have confirmed the redirect_uri value in the Network tab and it does match one of my Redirect URIs within the application.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NetworkTab.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/53585iB14F9947A1687607/image-size/medium?v=v2&amp;amp;px=400" role="button" title="NetworkTab.png" alt="NetworkTab.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I've tried to isolate mainly the auth portion itself away from the rest of the code for testing purposes and this is what I have:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="utf-8" /&amp;gt;
    &amp;lt;meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" /&amp;gt;
    &amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;

    &amp;lt;link rel="stylesheet" href="https://js.arcgis.com/4.24/esri/themes/light/main.css" /&amp;gt;
    &amp;lt;link rel="stylesheet" href="../siteassets/css/style.css" /&amp;gt;
    &amp;lt;script src="https://js.arcgis.com/4.24/"&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;/head&amp;gt;

  &amp;lt;body&amp;gt;
    &amp;lt;button id="signInBtn" type="button"&amp;gt;Sign In&amp;lt;/button&amp;gt;
    &amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;

    &amp;lt;script type="text/javascript" src="../siteassets/js/script.js"&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the Javascript&amp;amp;colon;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;require(["esri/portal/Portal", "esri/identity/OAuthInfo", "esri/identity/IdentityManager"], (Portal, OAuthInfo, esriId) =&amp;gt; {
  let info = new OAuthInfo({
    appId: (App Client Id Here),
    flowType: "auto",
    popup: false,
  });

  esriId.registerOAuthInfos([info]);

  esriId
    .checkSignInStatus(info.portalUrl + "/sharing")
    .then(handleLoginSuccess)
    .catch(() =&amp;gt; {
      console.log("Not logged in");
    });

  document.getElementById("signInBtn").addEventListener("click", () =&amp;gt; {
    esriId.getCredential(info.portalUrl + "/sharing");
  });

  function handleLoginSuccess() {
    const portal = new Portal();
    portal.authMode = "immediate";
    portal.load().then(() =&amp;gt; {
      console.log(portal);
    });

    loadMap();
  }
});

function loadMap() {
 // Code for map here
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for any help offered!&amp;nbsp; I have spent hours and hours trying to solve this to no avail.&amp;nbsp; I'm out of directions to attempt to even start in.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 18:37:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/oauth-2-0-invalid-redirect-uri/m-p/1221707#M1163</guid>
      <dc:creator>DaltonR121</dc:creator>
      <dc:date>2022-10-13T18:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: OAuth 2.0 Invalid Redirect URI</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/oauth-2-0-invalid-redirect-uri/m-p/1221835#M1164</link>
      <description>&lt;P&gt;Well as embarrassing as this is... I discovered the Client Id was incorrect.&amp;nbsp; Leaving up as a reminder to check Client Id if you run into this error.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 22:04:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/oauth-2-0-invalid-redirect-uri/m-p/1221835#M1164</guid>
      <dc:creator>DaltonR121</dc:creator>
      <dc:date>2022-10-13T22:04:59Z</dc:date>
    </item>
  </channel>
</rss>

