"Request cannot be processed" when using JHipster Google Social Login - jhipster

I am trying to add the social login with google feature to a newly generated JHipster application. I have configured a google project with the client id and client secret and added the correct urls and redirect urls. I have added the 'signin' to the webpack.dev.js server configuration. This is what is currently happening:
After I select which account I want to use to log in with google I am redirected to a page that says "Your request cannot be processed" with the following url "http://localhost:9060/signin?error=provider#".
Am I missing something?

Related

I'm getting a redirect_uri_mismatch when deploying my Node.js app to Heroku using Google OAuth2

I'm tasked with making a server using Node.js which will read emails from a Google account and parse the content from those emails into data we can store in a database. I'm using Google's googleapis package (v103.0.0) in NPM to authenticate/authorize with whichever account we'd like to use.
The issue comes when we try to switch accounts and have the user re-auth. During development on a local machine, the Auth process works as expected:
The client requests an Auth URL.
The server generates a new Auth URL and sends it back to the client.
The client redirects to that URL and the Google Consent Screen is shown.
The client is asked to choose between logged-in Google accounts.
The client authorizes the application and is redirected back to the server with a code.
The server uses the code to generate/save a token, which allows it to use the Gmail API.
However, after deploying to Heroku, the Google Consent Screen no longer allows the user to select an account. Instead, at step 3, it shows this message. In just about every other question related to this error, there's always additional information below the error code/message, but nothing's there for me. I made sure: (1) the domain I'm using in Heroku is verified on the Google Cloud Console, and (2) the redirect_uri within the Node.js application is passing the correct domain to the Auth URL, even while in production.
I can't provide the URL for privacy reasons, but let me know if there's any source code or Cloud Console info I should include.
It didn't take long after posting this question, but I realized I was using an incorrect OAuth 2.0 Client ID type. I was attempting to use "Desktop" when I should've been using "Web application" instead. Take a look at this image to see the difference.
When you select "Web application", you're given some new options: Authorized JavaScript origins, and Authorized redirect URIs. This is where you need to fill out the allowed URIs. Here's a sample of what that should look like.

How to add Azure static web app URL to the Google OAuth 2.0 client ID redirect URL at Google developer console

I have created an Azure static web app with the default URL we usually get when it is deployed(eg: https://xxx.1.azurestaticapps.net).
I have created a login with google functionality in my app and locally it works fine. But when I try to add the static web app URL as a redirect URL at the Google developer console, under OAuth 2.0 client ID, it seems that it does not allow me to add the particular URL.
It just shows an error saying that an error occurred!
Does anybody know why this happens?

cannot load url error in facebook login using node in localhost

I know there are lot of posts and blogs regarding this error but most of the answers were related to the wrong url in the OAuth Redirect URIs and have tried all of them.
Currently I trying to login with facebook on my localhost only.
any help would be appreciated as I am struck here for a long time.
finally i was able to resolve it. I added the test app by clicking on the option button of the my app and then creating test app for it.
In oauth2 (google, facebook, linkedin, etc) there are 2 parameters that need to be configured:
domain or origin
redirect or callback
In Facebook App Settings we have:
App Domain (Your problem)
sample: acme.com
The domain should be without "https" or "www" or "subdomain":
Site URL
sample: http://acme.com/
OAuth redirect URI
sample: http://acme.com/auth/facebook/callback
/auth/facebook/callback must be a route in your nodejs express.
Advice
Review char by char the explained values in your facebook configuration page.
Source
https://help.sharetribe.com/en/articles/1317484-how-to-solve-the-can-t-load-url-the-domain-of-this-url-isn-t-included-in-the-app-s-domains-facebook-login-error
Facebook OAuth "The domain of this URL isn't included in the app's domain"

How to add new 'authorized redirect uris' and 'Authorized JavaScript origins' using PHP?

I have project with login function via google's account. To do this, I had to created Credentials for my application. After that, I add new Authorized JavaScript origins is my domain name, and authorized redirect uris is my url to function login with google, all of them is in Client ID for Web application tab.
When I setup my application in new domain, I have to type new domain and new uri into google console.
Now, I make my application setup in a new domain automatically, everything is ok. But I can't use login function via google, because I don't register new domain in google console. So I want to add new 'authorized redirect uris' and 'Authorized JavaScript origins' automatically when I setup my application.
My application is written by PHP. Anyone, who can help me? THANKS?

Logout is not working in Microsoft Azure Web App

I am using the following method to implement logout functionality for Azure Web App.
I am using the url https://login.microsoftonline.com/{0}/oauth2/logout?post_logout_redirect_uri={1} where {0} is the Azure AD url and {1} is the web app url.
Sample url: https://login.microsoftonline.com/myazuread.onmicrosoft.com/oauth2/logout?post_logout_redirect_uri=http://myazurewebapp.azurewebsites.net
This gives me the output stating
You signed out of your account
It's a good idea to close all browser windows."
But when I put the site url on the browser the user goes through without going through authentication. I have also added code for expiring the cookies, but it's not helping. After signout I want the user to be redirected to the login page and also the user should have to go through authentication for logging in.
According to your description, I have created a new ASP.NET Web Application that doesn't require any user authentication, then I followed this tutorial for configuring my web app to use AAD login.
To restrict access to your site to only users authenticated by Azure Active Directory, set Action to take when request is not authenticated to Log in with Azure Active Directory.
When a user has logged in, you could find a cookie named AppServiceAuthSession as follows:
For a simple way to log out, you could just call https://{your-webapp-name}.azurewebsites.net/.auth/logout, this in-build endpoint would clear your browser cookies first, then redirect you to process the log out at Azure AD end as follows:
When the log out operation is finished at Azure AD side, the browser would redirect you to the post_logout_redirect_uri(/.auth/logout/complete by default) as follows:
In summary, please leverage fiddler to capture the requests when performing log out in your web app, and try to see whether the cookie AppServiceAuthSession has been removed after you logged out.
#Bruce . No i am not using any URL authentication rules . let me tell you whats happening step by step .
1)I have used the same url u have provieded as log out url .
2) Page is redirecting to the https://login.microsoftonline.com/myazuread.onmicrosoft.com/oauth2/logout?post_logout_redirect_uri=https://mywebapp.azurewebsites.net/.auth/login/aad/callback . Its not getting redirected to the default logout page.
Image of cookies on the page after redirecting to logout url
3)If i navigate to the default logout page (/.auth/logout/complete) and click on "Return to website" for a brief moment it redirects to the azure ad login page //login.microsoftonline.com/dcc17943-54b6-4bc7-b284-71d39f03aeb0/oauth2/authorize?response_type=id_token&redirect_uri=https%3A%2F%2Fmywebapp.azurewebsites.net%2F.auth%2Flogin%2Faad%2Fcallback&client_id=1ab2f820-2ca0-4a78-bfea-c849b91d339d&scope=openid+profile+email&response_mode=form_post&state=redir%3D%252F%26b2cPolicy%3D&nonce=d74940629d5e434eb6454648d33f371d_20170215104002 . Seems like it gets authenticated there automatically . And then redirects to the home page . I have deleted cookies manually too . Still the same result .
#Bruce I found something . If i manually delete all the cookies from chrome://settings/cookies and then redirect the page then it works . Can i do it programatically ? using javascript or C#
One reason that your post logout redirection is not working might be beacuse of this Azure AD behavior that caused issues in my case:
It doens't work for root accounts of the tenant, that is my personal
account, which created Azure subscription.
But it works for new accounts I created inside of my subscription.

Resources