datatools-ui icon indicating copy to clipboard operation
datatools-ui copied to clipboard

Auth0 implementation not working

Open wtchen opened this issue 1 year ago • 6 comments

NOTE: This issue system is intended for reporting bugs and tracking progress in software development. Although this software is licensed with an open-source license, any issue opened here may not be dealt with in a timely manner. IBI Group is able to provide technical support for custom deployments of this software. Please contact Ritesh Warade if your company or organization is interested in opening a support contract with us. Please remove this note when creating the issue.

Observed behavior (please include a screenshot if possible)

I was not able to log in with Auth0, getting the following error: Uncaught Error: Error: An error occurred when fetching client data for Lock: [https://cdn.us.auth0.com/client/Lt2sguBi0qWkjQS0qUhYDtU5BmNTXhLN.js?t1663261365919 1](https://cdn.us.auth0.com/client/vgRH8Hb3bBt94320kT1WIe7TrqgINyk5.js?t1663261365919) could not be loaded.

After doing some investigation, it looks the Auth0 no longer supports the API used in the latest datatools-ui release. So I forked this repo and updated the Auth0 APIs and some related code.

Now I'm able to log in, but I'm able to do much.

For example, I try to view a project:

image

But click on view test doesn't do anything.

Expected behavior

I should be able to log in with an Auth0 user, create a project, and view the project.

Steps to reproduce the problem

See above.

Any special notes on configuration used

See my forked code.

I'm running everything inside Docker.

Version of datatools-ui and datatools-server if applicable (exact commit hash or branch name)

v5.0.0 release

wtchen avatar Jun 30 '23 22:06 wtchen

Thanks for reporting! You are correct, we have some work to do when it comes to getting auth0 to function correctly. For now, our stopgap solution is as follows:

Using the https://github.com/ibi-group/datatools-ui/tree/auth-disable branch, env.yml now supports DISABLE_AUTH=true. This needs to also be set in the server env.yml.

These flags will disable auth0. There are still some bugs. For example, the homepage does not work, but localhost:9966/project does.

This branch is still a work in progress, but we welcome PRs.

miles-grant-ibigroup avatar Jul 03 '23 13:07 miles-grant-ibigroup

Thanks! It's good to know about that branch.

I'm able to create a project, but I'm getting a blank page when I try to view the project. I was wondering you could help us get this running; we seem to be getting close.

I'm getting React errors like:

Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

and

Uncaught TypeError: can't access property "length", project.labels is undefined

My env.yml is:

DISABLE_AUTH: true
AUTH0_CLIENT_ID: [MY_ID]
AUTH0_DOMAIN: [MY_DOMAIN]
MAPBOX_ACCESS_TOKEN: [MY_TOKEN]
MAPBOX_MAP_ID: mapbox/outdoors-v11
MAPBOX_ATTRIBUTION: <a href="https://www.mapbox.com/about/maps/" target="_blank">&copy; Mapbox &copy; OpenStreetMap</a> <a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a>
GRAPH_HOPPER_KEY: [MY_KEY]

I don't see any XHR to/from localhost:4000 (where datatools-server is running).

If helpful, here is my response for http://localhost:9968/api/manager/secure/project/854924ca-2fc9-452b-8138-0f0a67933a5b:

{
	"id": "854924ca-2fc9-452b-8138-0f0a67933a5b",
	"lastUpdated": 1688686979063,
	"dateCreated": 1688686979043,
	"name": "test3",
	"useCustomOsmBounds": false,
	"buildConfig": {
		"fetchElevationUS": null,
		"stationTransfers": null,
		"subwayAccessTime": null,
		"fares": null
	},
	"routerConfig": {
		"numItineraries": null,
		"walkSpeed": null,
		"stairsReluctance": null,
		"carDropoffTime": null,
		"updaters": null,
		"requestLogFile": null
	},
	"organizationId": null,
	"defaultTimeZone": "Africa/Abidjan",
	"autoFetchFeeds": true,
	"autoFetchHour": 2,
	"autoFetchMinute": 0,
	"bounds": {
		"north": 53.0,
		"south": 52.0,
		"east": 14.0,
		"west": 12.0
	},
	"pinnedDeploymentId": null,
	"regionalFeedSourceId": null,
	"otpServers": [],
	"user": null
}

wtchen avatar Jul 06 '23 23:07 wtchen

The homepage doesn't work with DISABLE_AUTH=true. Try visiting localhost:9966/project instead. Also, make sure DISABLE_AUTH=true is also set in the server's env.yml!

miles-grant-ibigroup avatar Jul 07 '23 13:07 miles-grant-ibigroup

Hi @wtchen, the code to support configs where DISABLE_AUTH = true (has to be both frontend and backend) is now in the dev branch for you to try out. Please update the issue status or close after testing. Thanks for your patience!

binh-dam-ibigroup avatar Jul 25 '23 16:07 binh-dam-ibigroup

Hello, I am facing the same issue. Unfortunately I need the authentication in order to use the application. Is the issue resolved or the answer is still disabling the authentication ? Thanks in advanced !

CelieTrg avatar Aug 09 '24 09:08 CelieTrg

The answer is still disabling authentication!

miles-grant-ibigroup avatar Aug 09 '24 10:08 miles-grant-ibigroup