Auth0 login locally - auth0

I have an application and an api, in terms of auth0, an static frontend and a expressjs backend, in production both are working. I setup Auth0 and users are able to login with Google accounts.
In production is working, but the problem I am facing is when I am working on my locally, when I run the application on my computer and I try to login I get the following error
Unhandled Runtime Error
Error: Request failed with status code 401
In the application setup I have
Allowed Callback URLs
https://www.myexample.com, http://localhost:3000, https://myexample.us.auth0.com/api/v2/
Allowed Logout URLs
https://www.myexample.com, http://localhost:3000
Allowed Web Origins
https://www.myexample.com, http://localhost:3000
and in the frontend
<Auth0Provider
domain="myexample.us.auth0.com"
clientId="XXXXXXXXXXX"
redirectUri={(process.browser) ? window && window.location.origin : 'http://localhost:3000'}
audience="https://myexample.us.auth0.com/api/v2/"
scope="read:current_user update:current_user_metadata"
>
If further information is needed, just let me know
I am not sure if I am missing some config or there is something I should change?

Related

facebook oauth error using keycloak Can't load URL: The domain of this URL isn't included in the app's domains

I am trying to implement social login using keycloak in a react-native application and upon following official keycloak documentation I have hit a dead end.
I have correctly configured (according to documentation) the correct redirect URI.
Details-
1.created a new facebook app. Now I have two different web resources.
a.) An instance running keycloak server on a docker setup.
b.) A dummy web app on a different domain that I am redirecting to using my react native code. I am using react-native-login package and the configuration which goes into their Login.start(config) method is attached below.
2.The website uri is the facebook app setting is same as the redirect uri that keycloak provides upon adding an identity provider.I have double checked my app id and app secret
and switched the app to production by giving it a privacy policy on the dummy express aplication I am trying to redirect to.
3.The keycloak server and the dummmy express app I have are on different domains (I don't see any problems with this but the tutorial I was following had the website and the keycloak server on the same domain with different sub domains could this be the problem).
The error
{
"error": {
"message": "Can't load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and sub-domains of your app to the App Domains field in your app settings.",
"type": "OAuthException",
"code": 191,
"fbtrace_id": "Awr-3dCV3zr"
}
}
config object
const config = {
url: "https://authserver.ml/auth",
realm: "Demorealm",
client_id: "demoFrontEnd",
redirect_uri: "https://dummyapp.ml/privacypolicy",
appsite_uri: "https://dummyapp.ml",
kc_idp_hint: "facebook",
};
website URI in facebook = redirect uri by keycloak (according to keycloak documentation)
added both the domains in the domains section of facebook app settings under the basic tab.
In the Share Redirect Domain Allow List section in advanced settings in facebook app I have added both the URI's ie. the authentication broker url from keycloak and the uri I am trying to redirect to after a successful login but I get this error everytime
Another scenario I have noticed is when I try to give the react-native-login config object a redirection uri that is mentioned in keycloak I get the invalid parameter error from keycloak
NOte- the error is arising from facebook's graph api which means that the authentication request went past the keycloak server and to facebook (https://graph.facebook.com/oauth/authorize?scope=email&state=rest of the url)
Any suggestions at this point will be much appreciated.

Callback URL not working in Auth0, locally

I am trying to configure login using Auth0. As part of the initial steps, I created an application and added Allowed Callback URLs and Allowed Logout URLs. I have no hosted pages in /login, /login-results, /logout routes. I am just trying to learn working of Auth0 by getting the JWT token and test it in http://jwt.io/.
I tried to use the login UI flow which available out of the box in Auth0. I created the login URL as mentioned in this doc to hit this endpoint
GET https://YOUR_DOMAIN/authorize?audience=API_IDENTIFIER&scope=SCOPE&response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=https://YOUR_APP/callback&state=STATE
But I am getting this error while executing the endpoint which I created using the credentials of my application with above-mentioned callback URL.
http://127.0.0.1:8080/login-results#error=access_denied&error_description=Service%20not%20found%3A%20name
Endpoint which I generated:
https://fsnd-kavin.auth0.com/authorize?audience=audiencename&response_type=token&client_id={CLIENT_ID}&redirect_uri=http://127.0.0.1:8080/login-results
What is the actual issue? Am I missing any other configurations?
Service Not Found
This error message points to that you passed non existent API identifier as audience. Check that API is created in the API section of Dashboard.

Docker API logs JWT issue

I am using Docker to run containers for an app that uses Angular, Identity Server, and an API(using a Compose.yml file to run them all together).
The API is responsible for returning database info, based on the user logged in through Identity Server. Locally, the API returns the user info after login without any issues. However, when I use Docker to run the app, the user can login but not have their db info returned to the angular page. I checked the logs for the API container, and am receiving the following errors:
fail: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[3]
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
So it appears to me that there is an issue with the API receiving the token. I only see these error messages after I login through ID server. The ID server container logs do not display any errors before or after I login.
Can someone help me resolve this issue?

App not listed in authorized apps in google account

When i try get access token via oauth (oauth screen with Allow button) on my local machine it works, but when i do the same on test server: i get oauth screen, i press allow and it's redirects to callback uri with code, and then app asking for token (i use PHP lib):
$client->authenticate($request->get('code'));
$access_token = $client->getAccessToken());
and i get null in response and application does not get authorized and it's not in authorized apps in google account.
I've checked redirect URLs listed in Google APIs - everything matches!
And i don't get any errors from google, it's just redirects to callback url and not adds application to authorized apps list.
But it works on local with same credentials. Any one can help me and guide where the problem can be?
Solved. I did not set redirect url before $client->authenticate($request->get('code'));

Getting error on login with angular 2 google and firebase

I am using firebase 3 and ng 2.
My issue I am getting error when click on connect with google account.
My error is:
Error: redirect_uri_mismatch
400. That’s an error.
Error: redirect_uri_mismatch
Application: Events Manager
You can email the developer of this application at: .....#gmail.com
The redirect URI in the request, https://......firebaseapp.com/__/auth/handler, does not match the ones authorized for the OAuth client. Visit https://console.developers.google.com/......apps.googleusercontent.com?project=181586 to update the authorized redirect URIs.
my project runs on http://localhost:3000/#/login
when I am going to console.developers.google.com Authorized redirect URIs-> http://localhost:3000/
Any idea whey is it happens?
the issue was need to add to firebase auth link the correct host.
firebase-> OAuth redirect domains