Hey everyone,
Loving RedwoodJS so far. What a great project. I’ve been following the tutorial / docs and have attempted to add authentication via Auth0 and am hitting what I think is either a bug or me not understanding the docs fully.
After running yarn rw g auth auth0
-
I have set up an Auth0 account, created both an SPA Application and an API.
-
I have put the domain and client id from the SPA Application as
AUTH0_DOMAIN
andAUTH0_CLIENT_ID
environment variables in my.env
file. -
I have put the identifier from the API as the
AUTH0_AUDIENCE
environment variable in my.env
file.
When I restart my dev server, I get a blank screen with the following console error:
Uncaught (in promise) TypeError: client.getUser is not a function
at _callee4$ (authClient.js:119)
at tryCatch (runtime.js:45)
at Generator.invoke [as _invoke] (runtime.js:274)
at Generator.prototype.<computed> [as next] (runtime.js:97)
at asyncGeneratorStep (asyncToGenerator.js:5)
at _next (asyncToGenerator.js:27)
at asyncToGenerator.js:34
at new Promise (<anonymous>)
at new Wrapper (export.js:15)
at Object.<anonymous> (asyncToGenerator.js:23)
at Object.currentUser (authClient.js:134)
at AuthProvider._callee3$ (AuthProvider.js:142)
at tryCatch (runtime.js:45)
at Generator.invoke [as _invoke] (runtime.js:274)
at Generator.prototype.<computed> [as next] (runtime.js:97)
at asyncGeneratorStep (asyncToGenerator.js:5)
at _next (asyncToGenerator.js:27)
In my Auth0 logs, I am seeing the following (I’m masking the sensitive parts with ****):
Full output:
{
"date": "2020-06-05T17:58:45.162Z",
"type": "fsa",
"description": "Login required",
"client_id": "*******",
"client_name": "GeoCities",
"ip": "*******",
"user_agent": "Chrome 83.0.4103 / Mac OS X 10.15.4",
"details": {
"body": {},
"qs": {
"client_id": "*******",
"redirect_uri": "http://localhost:8910/",
"audience": "https://******.dev/auth",
"scope": "openid profile email",
"response_type": "code",
"response_mode": "web_message",
"state": "NE95bm8ySVpWaThxWEZzZi5sRmd+bWJ5T3NDQVdSbEoxVWVZYnFPYjREUw==",
"nonce": "RC52M0lQUXZEfnRQUTR1WWs0V3MwcVNNRmFDWTc1VzFZUDVJNGtMQWFNUw==",
"code_challenge": "FetxtDg5-bhduZgKF8t5uiNf7iXxB7hOoTcIKc5RdIE",
"code_challenge_method": "S256",
"prompt": "none",
"auth0Client": "eyJuYW1lIjoiYXV0aDAtc3BhLWpzIiwidmVyc2lvbiI6IjEuOS4wIn0="
},
"connection": null,
"error": {
"message": "Login required",
"oauthError": "login_required",
"type": "oauth-authorization"
}
},
"hostname": "******.auth0.com",
"audience": "https://******.dev/auth",
"scope": [
"openid",
"profile",
"email"
],
"auth0_client": {
"name": "auth0-spa-js",
"version": "1.9.0"
},
"log_id": "90020200605175850402000145422265658362905777862510379090",
"_id": "90020200605175850402000145422265658362905777862510379090",
"isMobile": false
}
Did I miss something in configuration (either on the Redwood side or the Auth0 side)?
Thanks.