Skip to content

Commit

Permalink
Update 01. Setup And Authentication.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
chuongmep committed May 6, 2024
1 parent a8cd4de commit 69fbab9
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions APSToolkitPython/Tutorials/01. Setup And Authentication.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,46 @@
"source": [
"Congratulations! You've successfully obtained a 2-legged token from Autodesk Forge. You can now use this token to authenticate requests to Autodesk Forge services, such as the Data Management API or the Model Derivative API."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Get User Information\n",
"To get the user information logged in, you need to make sure that you used the 3-legged token to get the user information."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from aps_toolkit import Auth\n",
"redirect_uri = \"http://localhost:8080/api/auth/callback\"\n",
"scopes = 'data:read viewables:read'\n",
"token = auth.auth3leg(redirect_uri, scopes)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"User: Ho Van Chuong\n",
"Job Title: Computational Design Researcher\n"
]
}
],
"source": [
"user_infor = auth.get_user_info()\n",
"print(\"User:\",user_infor[\"name\"])\n",
"print(\"Job Title:\",user_infor[\"job_title\"])"
]
}
],
"metadata": {
Expand Down

0 comments on commit 69fbab9

Please sign in to comment.