Compare commits

...

1 Commits

Author SHA1 Message Date
Alan Rynne f52d6c46cb Changes login from latest to XYZ (#35)
* feat: Adds XYZ login instead + minor cleanup

* fix: Added tracking to both exposed functions
2022-12-20 19:00:02 +01:00
4 changed files with 22 additions and 29 deletions
+13 -25
View File
@@ -1,6 +1,10 @@
[Version = "2.0.0"]
section Speckle;
AuthAppId = "63463ba25d";
AuthAppSecret = "c317a7ce45";
AuthServer = "https://speckle.xyz";
// The data source definition, used when connecting to any speckle server
Speckle = [
// This is used when running the connector on an on-premises data gateway
@@ -8,10 +12,10 @@ Speckle = [
// This is the custom authentication strategy for our Connector
Authentication = [
OAuth = [
Label = "Speckle Login (latest only)",
Label = "Speckle.xyz",
StartLogin = (clientApplication, dataSourcePath, state, display) =>
[
LoginUri = Text.Combine({"https://latest.speckle.dev/authn/verify", "1ea917e25a", state}, "/"),
LoginUri = Text.Combine({AuthServer, "authn", "verify", AuthAppId, state}, "/"),
CallbackUri = "https://oauth.powerbi.com/views/oauthredirect.html",
WindowHeight = 800,
WindowWidth = 600,
@@ -21,7 +25,7 @@ Speckle = [
let
Parts = Uri.Parts(callbackUri)[Query],
Source = Web.Contents(
Text.Combine({"https://latest.speckle.dev", "auth", "token"}, "/"),
Text.Combine({AuthServer, "auth", "token"}, "/"),
[
Headers = [
#"Content-Type" = "application/json"
@@ -29,8 +33,8 @@ Speckle = [
Content = Json.FromValue(
[
accessCode = Parts[access_code],
appId = "1ea917e25a",
appSecret = "7d1cb26028",
appId = AuthAppId,
appSecret = AuthAppSecret,
challenge = state
]
)
@@ -47,7 +51,7 @@ Speckle = [
Refresh = (dataSourcePath, refreshToken) =>
let
Source = Web.Contents(
Text.Combine({"https://latest.speckle.dev", "auth", "token"}, "/"),
Text.Combine({AuthServer, "auth", "token"}, "/"),
[
Headers = [
#"Content-Type" = "application/json"
@@ -55,8 +59,8 @@ Speckle = [
Content = Json.FromValue(
[
refreshToken = refreshToken,
appId = "1ea917e25a",
appSecret = "7d1cb26028"
appId = AuthAppId,
appSecret = AuthAppSecret
]
)
]
@@ -68,23 +72,7 @@ Speckle = [
scope = null,
token_type = "bearer",
refresh_token = json[refreshToken]
],
Logout = (clientApplication, dataSourcePath, accessToken) =>
let
Source = Web.Contents(
Text.Combine({"https://latest.speckle.dev", "auth", "logout"}, "/"),
[
Headers = [
#"Content-Type" = "application/json"
],
Content = Json.FromValue([
token = accessToken
])
]
),
json = Json.Document(Source)
in
json
]
],
Key = [
KeyLabel = "Personal Access Token",
+1 -1
View File
@@ -1,2 +1,2 @@
// Use this file to write queries to test your data connector
let result = Speckle.Api.Fetch("https://latest.speckle.dev") in Record.ToTable(result)
let result = Speckle.GetByUrl.Structured("https://speckle.xyz/streams/ceecc65de7") in Record.ToTable(result)
+1 -1
View File
@@ -151,7 +151,7 @@
<value>Speckle</value>
</data>
<data name="GetStream.Title" xml:space="preserve">
<value>Speckle - Get Stream</value>
<value>Speckle - Get Stream by URL [Structured]</value>
</data>
<data name="GetObjectAsNavTable.Title" xml:space="preserve">
<value>Speckle - Get Object as NavTable</value>
+7 -2
View File
@@ -37,6 +37,11 @@ in
else
//We deal with object URLs directly
[referencedObject = stream[object]],
object = GetObject(server, id, commit[referencedObject])
object = GetObject(server, id, commit[referencedObject]),
rr = CommitReceived(server, id, commit),
result = Traverse(CleanUpObject(object) meta [server = server, stream = id, commit = commit])
in
Traverse(CleanUpObject(object) meta [server = server, stream = id, commit = commit])
if rr then
result
else
result