Comments (19)
I thought I'd just write the solution to this error
"No redirect URL has been found. You must either specify a signInSuccessUrl in the configuration, pass in a redirect URL to the widget URL, or return false from the callback"
All you need to do is return false
in the signInSuccess
callback
const uiConfig = {
callbacks: {
signInSuccess: () => false,
},
from firebaseui-web.
@brandonfajardo I used this way and it worked for me.
from firebaseui-web.
Please make "signInSuccessUrl" optional. If it's set, do the redirect, if not - do nothing.
This leads to some strange behaviour. I use firebase for authentication on my server and when I want to access the id_token (it's fetched async via user.getToken()), in the meantime - while I'm waiting for the token - the redirect occurs.
from firebaseui-web.
Your callback is returning a promise which evaluates to true.
from firebaseui-web.
You are returning a promise which resolves to true which triggers the redirect. Since no URL provided, an error is shown. Change the callback to be synchronous.
from firebaseui-web.
We will work on making that optional. However for you case, return false in your sign in callback so no redirect happens while you call user.getToken() or on resolution, do the redirect manually.
from firebaseui-web.
You are returning a promise which resolves to true which triggers the redirect. Since no URL provided, an error is shown. Change the callback to be synchronous.
@bojeil-google Is it possible to use async here?
from firebaseui-web.
signInSuccessUrl is currently always required even when false is returned in the callback.
from firebaseui-web.
I have the same issue. I hope it's fixed soon.
from firebaseui-web.
Just to clarify, the callback I was referring to is explained in the README.md in the "Example with all parameters used":
'callbacks': { 'signInSuccess': function(currentUser, credential, redirectUrl) { // No redirect. return false; } }
from firebaseui-web.
@bojeil-google could you expound a little for me. I'm extremely new to code and am having trouble redirecting manually. Here's what I tried. Any help would be greatly appreciated.
'callbacks': { 'signInSuccess': function(currentUser, credential, redirectUrl) { var user = currentUser; // var authenticated_URL = redirectUrl; if (user != null){ return true; authenticated_URL = 'https://google.com'; // authenticated_URL = '<my-website's-protected-page>; } else { return false; } } }
from firebaseui-web.
Hey @itispeach, the redirectUrl parameter is optional and will only be populate if you pass a signInSuccessUrl query parameter in the sign in widget url. I assume you are not passing. In addition signInSuccess callback will be triggered only when a user is logged in. So currentUser should always be populated. Here is one way you can do this:
'signInSuccessUrl': '<url-to-redirect-to-on-success>', 'callbacks': { 'signInSuccess': function(currentUser, credential, redirectUrl) { // This will redirect to redirectUrl if available or the signInSuccessUrl you specified in the config when // there is no redirectUrl. // return true; // If you to redirect manually, redirect here and return false. window.location.href = '<my-website's-protected-page>'; return false; } }
from firebaseui-web.
Hmmm, I'm still stuck. here's more of my code. I tried to apply your example, but I can still navigate strait to the "protected page" even though I'm in an incognito window. I must be missing a concept, here.
`<script src="https://www.gstatic.com/firebasejs/3.1.0/firebase.js"></script>
<script>
var config = {
apiKey: "give-this-to-no-one",
authDomain: "nor this",
databaseURL: "can't share this",
storageBucket: "for-me-to-know-and-you-to-find-out",
};
firebase.initializeApp(config);
</script>
<script src="https://www.gstatic.com/firebasejs/ui/live/0.4/firebase-ui-auth.js"></script>
<script type="text/javascript">
var uiConfig = {
'queryParameterForWidgetMode': 'mode',
'queryParameterForSignInSuccessUrl': 'signInSuccessUrl',
'signInSuccessUrl': '<private-site-that-only-authenticated-users-can-visit>',
'signInOptions': [
firebase.auth.EmailAuthProvider.PROVIDER_ID
],
'callbacks': {
'signInSuccess': function(currentUser, credential, redirectUrl) {
window.location.href = '<public-site-its-okay-to-visit>';
return false;
}
}
};
</script>`
Do I need to use this somewhere? firebase.auth().onAuthStateChanged(function(user) {});
from firebaseui-web.
Hey @itispeach, check the response I gave on stackoverflow:
http://stackoverflow.com/questions/38191852/is-there-a-signinfailureurl-parameter-for-github-project-firebaseui-for-web
from firebaseui-web.
We fixed this issue in the new release. It will raise an error only if there is the signInSuccessUrl
is required, i.e. if the signInSuccess
callback returns true
(i.e. proceed with redirect) and no redirectUrl
has been given as a URL parameter, or that both signInSuccessUrl
and signInSuccess
callback are not given.
from firebaseui-web.
@oliversisson Not work.
from firebaseui-web.
@bojeil-google Oh, thanks, solved.
from firebaseui-web.
Still receiving this error, please help! @bojeil-google
from firebaseui-web.
Why is this issue closed? Having a not so making sense work around did not really solve the problem.
In modern framework, it is a common scenario to route to various paths after signed in.
It is logical to make this field optional,
considering making it optional won't make a breaking change.
from firebaseui-web.
Related Issues (20)
- MFA Issue - internal server error 500 HOT 1
- FirebaseUI doesn't work properly in chrome mobile randomly: 20s latency onAuthStateChanged event HOT 7
- Incorrect error message when password requirements not met HOT 3
- Support Firebase JS SDK v9 and v10 HOT 3
- Typescript error when trying to use an async function for signInSuccessWithAuthResult callback HOT 1
- FirebaseUI compatibility with modular SDK HOT 1
- App Check isn't compatible with firebaseUI email login HOT 6
- Impossible to initialize firebase analytics for web
- Twitter authorisation throws "The supplied auth credential is incorrect, malformed or has expired. (auth/invalid-credential)"
- Will this project continue in 2024? HOT 1
- ANONYMOUS USER PROVIDER IS NOT WORKING IN FIREBASE UI HOT 3
- Working FirebaseUI Package for React and Next.js HOT 5
- Facebook logins stopped working on Android devices HOT 6
- Seems like Microsoft login doesn't work properly anymore HOT 1
- Unable to sign-in as cross-site cookies are blocked HOT 3
- Safari does not work on MacOS. It does not work at all on iOS devices - nor Chrome, nor Safari in redirect mode. HOT 1
- Google Sign-in doesn't work when AppCheck is enabled
- Catch all errors from sign in - improvement for signInFailure HOT 4
- [Firefox] Flash of unstyled content when sending/verifying phone otp HOT 2
- firebaseui doesn't work with sessionStorage when localStorage unavailable HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firebaseui-web.