<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Email with link to protected route]]></title><description><![CDATA[<p dir="auto">Starting from an email link, I'm trying to log in the user and then redirect the user to a protected route.  I was trying to do this by setting the state value in the configFusionAuth object and then using the state value in the onRedirect callback to set the route.<br />
I'm using React SDK with an express backend.    When using the link generated by generateProtectedUrl (see code below), I'm able to open the login form and log in, but state value is always undefined.</p>
<p dir="auto">What is the general approach to setting up this workflow?</p>
<p dir="auto">This is my logic to generate the email link.</p>
<pre><code>  async generateProtectedUrl(path) {
    try {
      const clientId = config.clientID;
      const baseUrl = config.fusionAuthBaseUrl;
      const redirectUri = 'http://localhost:5173';

      const state = 'test';

      const authUrl = new URL(`${baseUrl}/oauth2/authorize`);

      const params = {
        client_id: clientId,
        scope: 'openid offline_access',
        response_type: 'code',
        redirect_uri: redirectUri,
        state: state,
      };

      Object.entries(params).forEach(([key, value]) =&gt; {
        authUrl.searchParams.append(key, value);
      });

      return authUrl.toString();
    } catch (error) {
      console.error('Error generating protected URL:', error);
      throw error;
    }
  }
</code></pre>
]]></description><link>https://fusionauth.io/community/forum/topic/2883/email-with-link-to-protected-route</link><generator>RSS for Node</generator><lastBuildDate>Mon, 17 Aug 2026 04:10:26 GMT</lastBuildDate><atom:link href="https://fusionauth.io/community/forum/topic/2883.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 21 Feb 2025 17:55:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Email with link to protected route on Fri, 21 Feb 2025 18:34:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2007">@randall</a> have you checked out the documentation using <a href="https://fusionauth.io/docs/lifecycle/authenticate-users/passwordless/magic-links" rel="nofollow ugc">Magic Links</a>?  Does this get you what you need or am I missing something?</p>
]]></description><link>https://fusionauth.io/community/forum/post/7856</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/7856</guid><dc:creator><![CDATA[mark.robustelli]]></dc:creator><pubDate>Fri, 21 Feb 2025 18:34:39 GMT</pubDate></item><item><title><![CDATA[Reply to Email with link to protected route on Mon, 24 Feb 2025 04:17:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2507">@mark-robustelli</a> Thanks for pointing this out! Yes, magic links will work nicely.</p>
]]></description><link>https://fusionauth.io/community/forum/post/7857</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/7857</guid><dc:creator><![CDATA[randall]]></dc:creator><pubDate>Mon, 24 Feb 2025 04:17:34 GMT</pubDate></item><item><title><![CDATA[Reply to Email with link to protected route on Fri, 21 Feb 2025 18:34:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2007">@randall</a> have you checked out the documentation using <a href="https://fusionauth.io/docs/lifecycle/authenticate-users/passwordless/magic-links" rel="nofollow ugc">Magic Links</a>?  Does this get you what you need or am I missing something?</p>
]]></description><link>https://fusionauth.io/community/forum/post/7856</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/7856</guid><dc:creator><![CDATA[mark.robustelli]]></dc:creator><pubDate>Fri, 21 Feb 2025 18:34:39 GMT</pubDate></item></channel></rss>