Skip to content
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

How can I fix Auth0 AggregateError: TypeError: only valid absolute URLs can be requested #102

Closed
jngisiro opened this issue May 16, 2020 · 2 comments

Comments

@jngisiro
Copy link

I've been trying to configure Auth0 following the quickstart guide and setting up the configurations as per the documentation. But afterwards I can't seem to navigate to any route, even the /login auth0 route without getting the above mentioned error message.

This is my configuration code

export const config = { required: false, auth0Logout: true, appSession: { secret: process.env.AUTH0_CLIENT_SECRET }, baseURL: 'http://localhost:3001', clientID: process.env.AUTH0_CLIENT_ID, issuerBaseURL: process.env.AUTH0_DOMAIN };

The app using Auth0

`import express from 'express';
import { auth, requiresAuth } from 'express-openid-connect';

import { config } from './controllers/authController';

const app = express();

app.use(express.json());

app.use(auth(config));

// req.isAuthenticated is provided from the auth router
app.get('/', (req, res) => {
res.send(req.isAuthenticated() ? 'Logged in' : 'Logged out');
});

app.get('/profile', requiresAuth(), (req, res) => {
res.send(JSON.stringify(req.openid.user));
});`

the error message i keep getting

AggregateError: TypeError: only valid absolute URLs can be requested at module.exports (C:/Users/Paul Nisiro/Documents/Projects/Node/farmrail/src/services/user_api/node_modules/openid-client/lib/helpers/is_absolute_url.js:10:11)

@adamjmcgrath
Copy link
Contributor

Hi @jngisiro - The issuerBaseURL should be the "Domain prepended with https://. This can be set automatically with an ISSUER_BASE_URL variable in your environment." https://github.com/auth0/express-openid-connect/blob/master/API.md#required-keys

It looks like you've given it the value of a domain without the https://

@jngisiro
Copy link
Author

Thank you @adamjmcgrath I copied the url from my browser without the protocol. Would have taken me forever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants