-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added client_id and private key example to alternate tutorial
- Loading branch information
1 parent
fc007b6
commit a226e74
Showing
4 changed files
with
75 additions
and
2 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Alternate Tutorial for Minimal Application | ||
|
||
The RICOH360 Viewer requires two things to start: | ||
|
||
1. token for viewer | ||
2. contentId for the image you want to show | ||
|
||
```javascript linenums="1" hl_lines="4 8" title="index.html snippet" | ||
// instantiate viewer object | ||
const viewer = new RICOH360Viewer({ | ||
divId: "viewer", | ||
onFetchToken: () => "{{token}}", | ||
}); | ||
// start viewer with content | ||
viewer.start({ | ||
contentId: "{{contentId}}" | ||
}); | ||
``` | ||
|
||
## Setting up a virtual environment on Python | ||
|
||
Although not required, I recommend that you set up a virtual | ||
environment on Python. This avoids conflicting libraries on your main system | ||
Python. | ||
|
||
```text | ||
python -m venv venv | ||
source venv/bin/activate | ||
``` | ||
|
||
You should now see a `(venv)` prompt. | ||
|
||
```text | ||
(venv) craig@craigs-air practice % | ||
``` | ||
|
||
!!! tip inline end | ||
The Private Key and the Client Secret are not the same. You must | ||
get the Client ID, Client Secret, and Private Key from RICOH. The | ||
Private Key is for the Viewer. The Client Secret is for the content. | ||
|
||
## Viewer Token | ||
|
||
To generate the viewer token, you need the following: | ||
|
||
1. Client ID | ||
2. Private Key | ||
|
||
We will use PyJWT to generate the viewer token with the Private Key. | ||
|
||
### install PyJWT | ||
|
||
```text | ||
pip install PyJWT | ||
``` | ||
|
||
### Create `server.py` file | ||
|
||
Use VSCode or equivalent to create a file, `server.py`. | ||
|
||
At the top, include `import jwt`. | ||
|
||
Below the import, add your `PRIVATE_KEY` and `CLIENT_ID`. | ||
The Private Key is long. Put it in triple quotes. | ||
|
||
 | ||
|
||
The Client ID is shorter. | ||
|
||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,8 @@ site_author: Oppkey | |
|
||
theme: | ||
name: material | ||
# features: | ||
# - navigation.instant | ||
features: | ||
- content.code.copy | ||
logo: images/oppkey_logo.jpg | ||
favicon: images/oppkey_logo.jpg | ||
repo_name: [email protected]:theta360developers/ricoh-viewer.git | ||
|
@@ -19,6 +19,7 @@ nav: | |
- Contact: contact.md | ||
- Python Flask: python.md | ||
- Tutorial: tutorial.md | ||
- Alternative Tutorial: tutorial2.md | ||
- RICOH360 Cloud API: cloudapi.md | ||
|
||
plugins: | ||
|
@@ -32,3 +33,5 @@ markdown_extensions: | |
- pymdownx.inlinehilite | ||
- pymdownx.snippets | ||
- pymdownx.superfences | ||
- admonition | ||
- pymdownx.details |