<jupyter_start><jupyter_text>Get Access TokenIf you have previously registered a client using the authentication use case, use this script to create an access token.  Import modules, assign variables<jupyter_code>import requests
import json
import base64

# Global variables
sasserver = ""
username = ""
password = ""
client_id = ""
client_secret = ""<jupyter_output><empty_output><jupyter_text>Get access token for calls<jupyter_code>url = sasserver + "/SASLogon/oauth/token"

data = {
    'grant_type': 'password',
    'username': username,
    'password': password
}

headers = {'Accept': 'application/json'}

response = requests.post(url, headers=headers, data=data, auth=(client_id, client_secret), verify=False).json()

access_token = response["access_token"]

print("The access token is: " + access_token)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1163895486935867, 'fraction_numerical': 0.0023752969121140144, 'mean_word_length': 6.3304347826086955, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '653569', 'license': 'Apache-2.0', 'n_tokens_mistral': 261, 'n_tokens_neox': 257, 'n_words': 69, 'path': 'python/authentication/get-access-token.ipynb', 'repo_name': 'sassoftware/rest-api-use-cases', 'size': '842'}