-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Support iTwin share keys #12530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support iTwin share keys #12530
Changes from 4 commits
9855eaf
a83b4f2
ff43c90
2c40ff1
4446307
772368d
021f099
43bcc41
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,10 +31,13 @@ | |
window.startup = async function (Cesium) { | ||
"use strict"; | ||
//Sandcastle_Begin | ||
const serviceResponse = await fetch("https://api.cesium.com/itwin/token"); | ||
const { access_token: token } = await serviceResponse.json(); | ||
// Generate a share key for access to an itwin without oauth | ||
// https://developer.bentley.com/apis/access-control-v2/operations/create-itwin-share/ | ||
jjspace marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Cesium.ITwinPlatform.defaultShareKey = | ||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpVHdpbklkIjoiNTM1YTI0YTMtOWIyOS00ZTIzLWJiNWQtOWNlZGI1MjRjNzQzIiwiaWQiOiJmZTliOTgyMS0wYWI5LTQ4ZjItYmMzOC01NjQ5MTg5MDQyOTEiLCJleHAiOjE3NDQ5OTA2MjZ9.7bQIX32CGE4slLDPkOQZ4rRr4BqBSjbUOFAUvcdrFXE"; | ||
|
||
Cesium.ITwinPlatform.defaultAccessToken = token; | ||
// If you do use oauth for user login set: | ||
// Cesium.ITwinPlatform.defaultAccessToken = 'your token' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jjspace Do we need to have this here? Perhaps an update can point to the tutorial and developer documentation when ready. Same comment for the other sandcastle too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @shehzan10 We can certainly add more docs or tutorials later but I don't think there's an issue with providing this information in multiple locations. These sandcastles may end up being one of the main ways to quick reference how to interact with iTwin data in CesiumJS. I think it's worth keeping these 2 lines just for convenience/reference There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jjspace With the goal being to introduce this to the Cesium community via CesiumJS first, IMO its important to keep it simple. By having the comment
Open to other suggestions as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with @jjspace here, I think its nice to show users that they're able to use either form of authentication to use the sandcastle demo -- sharing or oauth. If you'd like to add more detail to suggesting oauth, you could point them do our oauth docs: https://developer.bentley.com/apis/overview/authorization/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be better to then have a comment like:
And combine this with line 35? |
||
|
||
// Set up viewer | ||
const viewer = new Cesium.Viewer("cesiumContainer", { | ||
|
Uh oh!
There was an error while loading. Please reload this page.