SolaraS
Solara17mo ago
Cyrus

Redirect URI error when testing login in solara app

Hi, I am trying to test an auth example in solara via okta. I have configured my app in okta following the solara docs and I am trying to test (locally) a simple login button. The relevant part of the snippet is
import solara
from solara_enterprise import auth

@solara.component
def Page():
 
  [...]

  if not auth.user.value:
      #print(auth.get_login_url())
      with solara.Tooltip('Login'):
          solara.Button(icon_name="mdi-login", href=auth.get_login_url(), icon=True)

I see the
login
button appear in my app but when I click on it a get a
invalid_request
error in the browser saying that the
redirect_uri
parameter in the request did not match any of the Login redirect URIs configured in the client application settings. If I print the output of
get_login_url
I get

/_solara/auth/login?redirect_uri=http%3A//localhost%3A8080


which is missing the main base url (what sets that value?)? Am I missing something in the configuration? I am setting these in my
.env

SOLARA_SESSION_SECRET_KEY=<<mysecretkey>>
SOLARA_OAUTH_CLIENT_ID=<<myclientid>>
SOLARA_OAUTH_CLIENT_SECRET=<<myclientsecret>>
SOLARA_OAUTH_API_BASE_URL=https://<<myissuer>>
SOLARA_SESSION_HTTPS_ONLY=False
SOLARA_BASE_URL=http://localhost:8080


and in okta I have set application login url as:
http://localhost:8080/_solara/auth/login


and allowed callback urls as:
authorize:
http://localhost:8080/_solara/auth/authorize

logout:
http://localhost:8080/_solara/auth/logout


is this correct?
Was this page helpful?