Replit.dev and Google OAuth

Hi all,

So I’ve been developing against Google’s Oauth using the cloud console - all was fine and dandy until the changes to hosting which meant that my dev URL now changes constantly.

The reason this is an issue is that building against this authentication system involves telling Google the JavaScript origins and Redirect URLs that your auth is using. These are no longer predictable and you cannot use wildcards as a option to whitelist the entire replitl.dev domain.

Is there either a way around this?
Can I add a static dev domain that I already own for these purposes?
Is there any predictable URL I can use?

Please note that I do not require the old style repl.co links - or hosting to be always on for the development server - just a predictable URL whilst the development is happening. Using deployments for testing is not an option as this would slow development down to painful levels.

2 Likes

The new dev URL should only change ~once a year. It’s always in this format

<repl-id>-00-<characters>.<repl-cluster>.replit.dev
(<characters> being what changes)

7 Likes

I’m not sure it does stay static - mine has definitely changed after a period of inactivity as all my test windows stopped responding and I even had to restart the repl to get the dev server working again - is this documented anywhere?

6 Likes

I don’t think so, but it was confirmed by Ray:

4 Likes

I believe there is some information r.e. this somewhere here: https://docs.replit.com/hosting/deployments/troubleshooting

6 Likes

Thanks :pray:
I have seen my replit.dev url change and I’m not moving anything between clusters.
Would love it if we could slap a custom domain on the replit.dev url though, would solve a lot of problems.

8 Likes

Feature Requests

5 Likes

@RayAtReplit @DavidAtReplit Even I am trying to add my flask project’s replit.dev URL in the ‘Authorized Javascript Origins’ and ‘Authorized Redirect URIs’ fields in my google cloud project for OAuth - but I am getting an error. Even if try to create a new GCP project, I am unable to add the project’s replit.dev URL as the ‘Authorized Domain’.

Can we not use replit.dev URLs for OAuth?

Hello! Could we get a link to your Repl so we can investigate what error you are running into? :slight_smile:

Its working now! I am not getting any errors for adding replit.dev URLs as authorized links

2 Likes

Awesome! It looks like your cluster had changed so now it should be stable for a good while :slight_smile:

2 Likes

i am getting same error https://replit.com/@sy9053988/Tri
can anyone tell how to fix it

Hello @sy9053988,
Please try insert host="0.0.0.0" inside the app.run(debug=True)
Please try:

app.run(debug=True, host="0.0.0.0")