<?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[error 401 depends on API Key settings]]></title><description><![CDATA[<p dir="auto">Hi.<br />
I have installed fusionauth on docker and I have written webhook that use FA API to update user data object.<br />
I use default tenant and have created new application.<br />
I have created new API Key and select /api/user for GET and PATCH that I use.<br />
In this case I get error 401<br />
But if I do not select  endpoints (a super user key) then update is successfull.</p>
<p dir="auto">FA version [1.31.0]</p>
]]></description><link>https://fusionauth.io/community/forum/topic/1442/error-401-depends-on-api-key-settings</link><generator>RSS for Node</generator><lastBuildDate>Tue, 18 Aug 2026 14:45:40 GMT</lastBuildDate><atom:link href="https://fusionauth.io/community/forum/topic/1442.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 30 Dec 2021 12:50:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to error 401 depends on API Key settings on Thu, 06 Jan 2022 09:22:59 GMT]]></title><description><![CDATA[<p dir="auto">I tried with all HTTP methods enabled for /api/user only, and it update user successfully.<br />
But if I tried only with GET and PATCH methods enabled for /api/user , I get 'statusCode=401'.<br />
Here is code</p>
<pre><code>import { FusionAuthClient, UserRequest } from '@fusionauth/typescript-client'
...
export class FusionAuthService {
    private fusionAuthClient: FusionAuthClient;

    constructor(private context: Context) {
        this.fusionAuthClient = new FusionAuthClient(context.config.fusionAuth.apiKey, context.config.fusionAuth.apiUrl);
    }

...
    public async updateUser(userId: string, userRequest: UserRequest ) {
        return this.fusionAuthClient.updateUser(userId, userRequest)
            .then(clientResponse =&gt; {
                logger.info("User:", JSON.stringify(clientResponse.response.user, null, 2));
            }).catch(logger.error);
    }
</code></pre>
<p dir="auto">here is invocation of updateUser method that happens on 'user.registration.create' event</p>
<pre><code>        if (user) {
            const patchBody = {
                user: {
                    email: event.user.email,
                    data: {
                        userId: user.id
                    }
                },
            }
            await this.fusionAuthService.updateUser(event.user.id, patchBody);
        }

</code></pre>
<p dir="auto">Now I understand that I use updateUser method and I don't know what kind of HTTP request it used.<br />
I have found  patchUser and with it get success.</p>
<p dir="auto">Thanks for your help.</p>
]]></description><link>https://fusionauth.io/community/forum/post/4152</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/4152</guid><dc:creator><![CDATA[muravyov.alexey]]></dc:creator><pubDate>Thu, 06 Jan 2022 09:22:59 GMT</pubDate></item><item><title><![CDATA[Reply to error 401 depends on API Key settings on Tue, 04 Jan 2022 12:31:57 GMT]]></title><description><![CDATA[<p dir="auto">Hiya,</p>
<p dir="auto">Can you share your code that makes the update? Can you try allowing all the HTTP methods for the key on the <code>/api/user</code> endpoint, not just GET and PATCH?</p>
]]></description><link>https://fusionauth.io/community/forum/post/4134</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/4134</guid><dc:creator><![CDATA[dan]]></dc:creator><pubDate>Tue, 04 Jan 2022 12:31:57 GMT</pubDate></item></channel></rss>