Sunday, July 17, 2022

Create an OAuth User to use Snowflake SQL API

The Snowflake SQL API is a REST API that you can use to access and update data in a Snowflake database. You can use this API to develop custom applications and integrations that:

  • Perform queries

  • Manage your deployment (e.g. provision users and roles, create tables, etc.)

The Snowflake SQL API provides operations that you can use to:

  • Submit SQL statements for execution.

  • Check the status of the execution of a statement.

  • Cancel the execution of a statement.

Referenced Code Below:

alter user yourUserName set default_role = sysadmin ;
create or replace security integration DEMO_OAUTH
type = oauth enabled = true oauth_client = custom oauth_client_type = 'CONFIDENTIAL' 
oauth_redirect_uri = 'https://oauth.pstmn.io/v1/browser-callback' 
oauth_issue_refresh_tokens = true oauth_refresh_token_validity = 86400;
DESCRIBE SECURITY INTEGRATION DEMO_OAUTH;
GRANT ALL ON INTEGRATION DEMO_OAUTH to SYSADMIN;

select system$show_oauth_client_secrets('DEMO_OAUTH');
Share: