<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Michael Maltese on Medium]]></title>
        <description><![CDATA[Stories by Michael Maltese on Medium]]></description>
        <link>https://medium.com/@michaelmaltese?source=rss-8262fe16652------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*rSqXlhLjCimwTYQNSTVxZw.png</url>
            <title>Stories by Michael Maltese on Medium</title>
            <link>https://medium.com/@michaelmaltese?source=rss-8262fe16652------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 05:10:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@michaelmaltese/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Debugging OAuth Errors in Sigma]]></title>
            <link>https://medium.com/@michaelmaltese/debugging-oauth-errors-in-sigma-e0e354f26f5f?source=rss-8262fe16652------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0e354f26f5f</guid>
            <category><![CDATA[sigma-computing]]></category>
            <category><![CDATA[oauth2]]></category>
            <category><![CDATA[oauth]]></category>
            <dc:creator><![CDATA[Michael Maltese]]></dc:creator>
            <pubDate>Tue, 25 Jan 2022 02:54:26 GMT</pubDate>
            <atom:updated>2022-02-04T17:29:00.433Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*1bEqKR4Xc9GFDMMLQJbxRw.png" /><figcaption>OAuth errors can be intimidating. Here’s how to fix them.</figcaption></figure><p><a href="https://sigmacomputing.com/">Sigma Computing</a> lets you set up OAuth for signing in to Sigma as well as <a href="https://help.sigmacomputing.com/hc/en-us/articles/360053705993-OAuth-with-Snowflake">running queries on Snowflake directly as the signed-in user</a>. This is often used if you want centralized permission management or fine-grained data access rules.</p><p>But setting up OAuth can be difficult! You have to coordinate three different systems: your IdP (Identity Provider), Sigma, and Snowflake. You also need to understand OAuth basics, which <a href="https://www.torocloud.com/blog/understanding-oauth">can be intimidating</a> and <a href="https://changelog.com/podcast/456">complicated due its long history</a>.</p><p>If any of these systems aren’t in agreement then you’re likely to run into inscrutable error messages. The systems themselves often aren’t that helpful because they don’t want to expose security information.</p><p>So, below, I’ve catalogued all of the different OAuth error messages I’ve seen with Sigma and how to go about solving them. I’ve also included sections at the bottom on getting the actual access token from Sigma to validate inside inside Snowflake, and on setting up the user mapping claim in various ways if you’re using Okta.</p><p>Good luck!</p><h3>Common OAuth errors and how to fix them</h3><p><strong>Could not connect to host: Could not get credential</strong></p><ol><li>You must log in to Sigma via OAuth, not via password. This commonly occurs when turning on “OAuth access” on a Connection for the first time.</li></ol><p><strong>Request is malformed: Error: Expecting string at code but instead got: undefined. One or more scopes are not configured for the authorization server resource.</strong></p><ol><li>The Authorization Server must support the ‘session:role-any’ scope. Why: Sigma requests this scope when attempting to log in via OAuth.</li></ol><p><strong>390303 (08004): Invalid OAuth access token.</strong></p><ol><li>The Snowflake Security Integration property EXTERNAL_OAUTH_JWS_KEYS_URL needs to match that returned by the OAuth Metadata URI used by Sigma. You can check this by opening the Metadata URI in your browser and comparing against the ‘jwks_uri’ field. Why: Snowflake validates the signature of the access token passed along by Sigma against the specified public keys list.</li><li>The Snowflake Security Integration property EXTERNAL_OAUTH_ISSUER needs to match that returned by the OAuth Metadata URI used by Sigma. You can check this by opening the Metadata URI in your browser and comparing against the ‘issuer’ field. Why: Snowflake validates that the ‘iss’ claim in the access token matches this value.</li><li>The Audience value in access tokens returned by the Authorization Server must be either the Snowflake full account name with https:// protocol and no trailing slash (e.g. <a href="https://xyz.snowflakecomputing.com/">https://xyz.snowflakecomputing.com</a>), or one of the values specified in EXTERNAL_OAUTH_AUDIENCE_LIST on the Snowflake Security Integration. Why: Snowflake validates that the ‘aud’ claim in the access token matches one of these values.</li><li>The claim specified in the Snowflake security integration property EXTERNAL_OAUTH_TOKEN_USER_MAPPING_CLAIM must exist in the access token. Make sure the claim is defined in the Authorization Server, that it is included for your client/scope/user, and that the definition is valid. Okta won’t include a claim if the definition has an error or results in an empty value. Why: Snowflake uses this claim to match the access token against a Snowflake user. If the claim is missing, Snowflake complains that the access token is invalid. If the claim exists but doesn’t match a user, Snowflake will return a different error message.</li></ol><p><strong>250001 (08001): The role requested in the connection or the default role if none was requested in the connection (‘SIGMA’) is not listed in the Access Token or was filtered. Please specify another role, or contact your OAuth Authorization server administrator.</strong></p><ol><li>The Access Token must include the ‘session:role-any’ scope. This is requested by Sigma by default, so if you can log into Sigma with OAuth then you should already have it. Why: Snowflake requires scopes of the form `session:role*` to know which Snowflake roles the user is allowed to use.</li><li>The Snowflake Security Integration property EXTERNAL_OAUTH_ANY_ROLE_MODE must be set to “ENABLE”. Why: Snowflake only allows the `session:role-any` scope when this security integration property is enabled.</li></ol><p><strong>250001 (08001): Incorrect username or password was specified.</strong></p><ol><li>The value of the claim specified in the Snowflake security integration property EXTERNAL_OAUTH_TOKEN_USER_MAPPING_CLAIM must match a Snowflake user.<br> <br>If EXTERNAL_OAUTH_SNOWFLAKE_USER_MAPPING_ATTRIBUTE is ‘LOGIN_NAME’, then the claim value must match a Snowflake user’s login name. You can check this using `describe user myusername`<br> <br>If EXTERNAL_OAUTH_SNOWFLAKE_USER_MAPPING_ATTRIBUTE is ‘EMAIL_ADDRESS’, then the claim value must match a Snowflake user’s email address.</li></ol><h3>Getting the OAuth access token used by Sigma</h3><p>You can get the OAuth access token used by Sigma by doing the following:</p><ol><li>Go to the Connection page</li><li>Enable “OAuth Access”</li><li>Open your browser DevTools/Network Inspector</li><li>Click the “Save” button on the Sigma Connection page</li><li>Note there should be a request to a ‘check’ endpoint that validates the OAuth flow. The response should be a JSON object with a field containing the Access Token.</li><li>What to do with this Access token:<br> <br>You can decode it using any available JWT software library<br> <br>You can decode it using an online tool like <a href="https://token.dev/">https://token.dev/</a><br> <br>You can verify it directly in Snowflake using select system$verify_external_oauth_token(“my_token”). This function returns much more verbose error messages that are helpful with debugging.</li></ol><h3>Defining the user mapping claim</h3><ul><li>Okta by default will add a &#39;sub&#39; (short for &#39;subject&#39;) claim defined as (appuser != null) ? appuser.userName : app.clientId. This will have the value of your Sigma username</li><li>If Snowflake emails are the same as Okta emails, then:<br> <br>In Okta: set the claim snowflake_email = user.email<br> <br>In Snowflake: set the security integration properties EXTERNAL_OAUTH_TOKEN_USER_MAPPING_CLAIM = ‘snowflake_email’ and EXTERNAL_OAUTH_SNOWFLAKE_USER_MAPPING_ATTRIBUTE = ‘email_address’</li><li>If Snowflake emails are the same as Sigma usernames, then:<br> <br>In Okta: set the claim snowflake_email = appuser.userName<br> <br>In Snowflake: set the security integration properties EXTERNAL_OAUTH_TOKEN_USER_MAPPING_CLAIM = ‘snowflake_email’ and EXTERNAL_OAUTH_SNOWFLAKE_USER_MAPPING_ATTRIBUTE = ‘email_address’</li><li>If Snowflake usernames are the same as Sigma usernames, then:<br> <br>In Okta: set the claim snowflake_username = appuser.userName<br> <br>In Snowflake: set the security integration properties EXTERNAL_OAUTH_TOKEN_USER_MAPPING_CLAIM = ‘snowflake_username’ and EXTERNAL_OAUTH_SNOWFLAKE_USER_MAPPING_ATTRIBUTE = ‘login_name’</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0e354f26f5f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>