ns_client: Create an OAuth2 Client for Nettskjema API

View source: R/ns-auth.R

ns_clientR Documentation

Create an OAuth2 Client for Nettskjema API

Description

This function initializes an OAuth2 client using the 'httr2::oauth_client' function. It is used to authenticate and interact with the Nettskjema API.

Usage

ns_client(client_id, client_secret, client_name = "nettskjemar")

Arguments

client_id

[character] The client ID provided by Nettskjema.

client_secret

[character] The client secret provided by Nettskjema.

client_name

[character] An optional name for the client (default = "nettskjemar").

Value

A configured 'httr2::oauth_client' object.

Examples

# Example: Initialize an OAuth2 client for Nettskjema
client <- ns_client(
  client_id = "your_client_id",
  client_secret = "your_client_secret"
)

# Using a custom client name
client <- ns_client(
  client_id = "your_client_id",
  client_secret = "your_client_secret",
  client_name = "custom_client_name"
)


nettskjemar documentation built on June 8, 2025, 10:20 a.m.