shuzmm
(Shuwei Z)
4 November 2022 02:25
1
Hi All,
I’ve gotten my webapp to the point where it can now be deployed. But running into another problem, which is getting the authenticated user.
I was following the tutorial here which builds a website in Vuetify, has anyone done this in streamlit?
Creating Your Own App | Speckle Docs
Not quite sure where to go from here so any pointers would be great!!
1 Like
gokermu
(Mucahit Bilal GOKER)
4 November 2022 05:39
2
Hey @shuzmm ,
@Wassim_Jabi made a streamlit app and afaik figured the authentication part. You can sneak peek into his code. I think below is how he figured it out.
2 Likes
Hi ping me if you need help authenticating to Speckle from Streamlit.
2 Likes
shuzmm
(Shuwei Z)
6 November 2022 19:48
4
Amazing stuff!! thanks for the assist @Wassim_Jabi will send you a message
2 Likes
tomasmena
(Tomas Mena)
16 January 2023 12:48
5
Hi everyone;
I´ve been trying to deply a simple streamlit app but I´m getting this authentication error in the streamlit platform:
2023-01-16 12:40:00.598 >>> {"query": "query Server {\n serverInfo {\n version\n }\n}"}
2023-01-16 12:40:01.118 <<< {"data":{"serverInfo":{"version":"2.11.4"}}}
2023-01-16 12:40:01.121 >>> {"query": "query Server {\n serverInfo {\n version\n }\n}"}
2023-01-16 12:40:01.416 <<< {"data":{"serverInfo":{"version":"2.11.4"}}}
2023-01-16 12:40:01.419 >>> {"query": "query User($id: String) {\n user(id: $id) {\n id\n email\n name\n bio\n company\n avatar\n verified\n profiles\n role\n }\n}", "variables": {"id": null}}
2023-01-16 12:40:01.757 <<< {"errors":[{"message":"You do not have the required privileges.","locations":[{"line":2,"column":3}],"path":["user"],"extensions":{"code":"FORBIDDEN"}}],"data":{"user":null}}
2023-01-16 12:40:01.761 >>> {"query": "query User($stream_limit: Int!) {\n user {\n id\n bio\n name\n email\n avatar\n company\n verified\n profiles\n role\n streams(limit: $stream_limit) {\n totalCount\n cursor\n items {\n id\n name\n role\n isPublic\n createdAt\n updatedAt\n description\n commentCount\n favoritesCount\n collaborators {\n id\n name\n role\n }\n }\n }\n }\n}", "variables": {"stream_limit": 10}}
2023-01-16 12:40:02.102 <<< {"errors":[{"message":"You do not have the required privileges.","locations":[{"line":2,"column":3}],"path":["user"],"extensions":{"code":"FORBIDDEN"}}],"data":{"user":null}}
If anyone has some inputs I´ll be be thankful
Best.
Tomás
jonathon
(Jonathon)
16 January 2023 13:00
6
Is stream sharing turned on? Or if not, are you passing a user token?
tomasmena
(Tomas Mena)
16 January 2023 13:07
7
Hi!
The stream is public and I am passing a user token.
When I launch it from the local host, it works without problem. is when I am deploying it on streamlit that is giving me this error.
1 Like
gokermu
(Mucahit Bilal GOKER)
16 January 2023 13:39
8
How are you authenticating? Can you share the repo?
AlanRynne
(Alan Rynne)
16 January 2023 13:40
9
I notice that you have a health check error on your deployed app that is pointing to localhost:8501
still. Not sure if it would be the cause of the issue. Maybe you have to update some value somewhere?
tomasmena
(Tomas Mena)
16 January 2023 13:48
10
Hi!
I´m authenticating with a token.
here you have the repo.
Thanks
tomasmena
(Tomas Mena)
16 January 2023 14:39
12
Finally I generated a new token and it granted me access. Now a new problem, the Iframe doesn´t show up .
1 Like
gjedlicska
(Gergő Jedlicska)
16 January 2023 14:40
13
Hey @tomasmena
First things first. You really shouldn’t have your token shared in a public repository, now I (or anyone else a bit more malevolent) can have access to your data. If you want to keep the authentication method wit a token I suggest you use an environment variable to store and retrieve the auth token.
I tried to clone your repo and run the app, but it failed for me too, because the baked in string token is invalid.
The reason why it works locally, is because specklepy
falls back to accounts available on your machine.
3 Likes
jonathon
(Jonathon)
16 January 2023 14:43
14
Good, now revoke it and use environment variables instead of inlining in the public code. Does streamlit support that?
So, the next step, is what is the developer console reporting? Is the viewer present in the DOM?
1 Like
gokermu
(Mucahit Bilal GOKER)
16 January 2023 14:43
15
afaik, streamlit does support environment variable.
1 Like
tomasmena
(Tomas Mena)
16 January 2023 14:48
16
The viewer is present on the DOM
jonathon
(Jonathon)
16 January 2023 14:49
17
I can see it hasn’t loaded, what does the console log report?
tomasmena
(Tomas Mena)
16 January 2023 14:52
18
5.1ebf0425.chunk.js:2 Mixed Content: The page at 'https://publicmachinery-winter-garden-main-c6ibzw.streamlit.app/' was loaded over HTTPS, but requested an insecure frame 'http://speckle.xyz/embed?stream=8dd22c09e4&commit=f42a6e31b6&autoload=true'. This request has been blocked; the content must be served over HTTPS.
jonathon
(Jonathon)
16 January 2023 14:53
19
If you add an s
to http
for the embed URL?
https://speckle.xyz/embed?stream=8dd22c09e4&commit=f42a6e31b6
1 Like
tomasmena
(Tomas Mena)
16 January 2023 14:58
20
It Works!!! thanks a lot for everyone’s patience !
@gjedlicska thanks for the observation… Really important. !
3 Likes
gokermu
(Mucahit Bilal GOKER)
16 January 2023 15:16
21
Hey @tomasmena ,
quick question: why did you authenticate? As far as I see, there is no need for authentication in your case. It is a simple embed viewer, isn’t it?
1 Like