Yii2 authclient Error: redirect_uri_mismatch - yii2

I am implementing yii2 authclient, I created the client id in in google api console this is the redirect url I created in gogle console with the corresponding client id.
http://mysite.x10host.com/oauth2callback
when I access my site login this is how it looks like
http://mysite.x10host.com/home/mysitex/public_html/web/site/login
when I click the the google icon
That’s an error.
Error: redirect_uri_mismatch
Application: Project Default Service Account
You can email the developer of this application at: myemail#gmail.com
The redirect URI in the request: http://mysite.x10host/home/mysitex/public_html/web/site/auth?authclient=google
can someone help me on this.
Thank you in advance

Related

Sync Chrome extension login with web app (Next JS)

I'm trying to sync chrome extension and web app login. I'm currently using Next Auth to get the access token for a provider. Any one has experience with it ? I am able to send message from the web app to the extension with the access token, but not sure how I can authenticate the user in the extension.
You can get Google auth token and authenticate the user, it will ask user to choose g-profile & login. Here is code that works for me:
backgroung.js:
chrome.identity.getAuthToken({ 'interactive': true }, function(token) {
console.log("token: " + token);
});

Yii2 : AuthClinet + Facebook login

i've create a Facebook login app and it works fine when it on localhost but when I published it online it gives me an error :
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 subdomains of your app to the App Domains field in your app settings.
i've update the app setting to be :
App Domains : *******.com
and also
Site URL :https://********.com/
and in Facebook login app setting is
Client OAuth Login : No
but error still appears

Dialogflow authentication API v2 - HTTP POST

I´m using dialogflow with http request on a project that works in twilio, with the recent need of migration to v2 API of dialogflow the client access token will not work. Reading the new authentication, I generated the json following the instructions in the google cloud docs, but can´t make it works. Because I need to do all the interaction through POST requests to the dialogflow agent, does anyone know how I can generate the authentication token well?
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED"
}
}
Thanks
This is the function code that today works to make the http request. The problem is that all the services are in Twilio and i dont have access to the server, for that I cant define the environment variable.
Twilio Function code
Twilio Fuctions uses NodeJs and allow me to install many npm modules, with the following limitation: "Native Packages Not Supported - Functions does not provide a C/C++ compliler required to complie native addon modules. This means modules that depend on node-gyp can not be installed to Functions."
I don´t know if this limitations affect service acount working to me in this case.

gdrive command line oauth2: cannot fetch token: 400 Bad Request

Suddenly, gdrive command line tool stops working, and always gives the following error message:
Failed to get about: Get https://www.googleapis.com/drive/v3/about?alt=json&fields=maxImportSizes%2CmaxUploadSize%2CstorageQuota%2Cuser: oauth2: cannot fetch token: 400 Bad Request
Response: {
"error": "invalid_grant",
"error_description": "Bad Request"
}
This is because your authorization token has expired.
Currently there is an open Issue to improve this error message here.
You should delete your token with rm ~/.gdrive/token_v*.json
then run the gdrive about command to reauthorize
The steps I fixed it:
rm ~/.gdrive/token_v2.json as other answer suggested.
But I get danger error if I open the link get from gdrive about to re-authorize:
So I create a drive project by go to https://developers.google.com/drive/api/v3/quickstart/js and click "Enable the Drive API":
Click the "API Console" link on that dialog:
To make default redirect url (i.e. urn:ietf:wg:oauth:2.0:oob) works, we need Installed type app and can't use "Web application type app"(which only allow http/https scheme). So click "Create credentials" and choose "Oauth client ID" item:
Ensure select "Other" type:
Copy "Client ID" and "Client secret" from created item. cd to ~/.go/src/github.com/prasmussen/gdrive/, then replace both at this two variables in handlers_drive.go file, save it, e.g.:
const ClientId = "xxx.apps.googleusercontent.com"
const ClientSecret = "xxx"
Then run go install at that directory. Now run gdrive about and open that link in web browser. I get This app isn't verified error page. You are the author who created that app on above steps and suppose safe. Nevertheless simply click "Advanced" link and click Go to Quickstart (unsafe) link:
Click "Allow" it, copy/paste the code back to gdrive about and done:
Managed to resolve this by retriggering gcloud authorization with:
gcloud auth application-default login

Postman Oauth 2 callback url - Chrome App

I am using The Chrome App for Postman and I am setting up my Access Tokens using OAUTH2. When I fill out the form, I am using the following:
Auth Url: https://[MY_API_URL]/api/authorize
Access Token URL: https://[MY_API_URL]/api/request/token
Client ID: xxxxxxxxxxx
Client Secret: xxxxxxxxxx
Scope: blank
Grant Type: Authorization Code
The callback url in my outh server is set to "https://www.getpostman.com/oauth2/callback"
When I click Request Token, I am taken to the proper Authentication page. When I submit my credentials, a new Chrome tab opens up with a blank page with the url https://app.getpostman.com/oauth2/callback?code=xxxxxxxxxx
I expect that this is supposed to redirect to the app so it can perform the access token request. from the access token url, but nothing is happening. Is this not the right callback uri?
This is an old question and things have changed since.
Google deprecated Chrome Apps, so Postman had to deprecate their old Chrome App client too, and so the old redirection URL (https://www.postman.com/oauth2/callback) no longer works.
According to this, with the more recent versions of Postman, the new redirection URL is https://oauth.pstmn.io/v1/callback.
You have change your permission type. Use Client Credentials instead of Authorization
I also faced same problem.
Just change Grant Type: Authorization Code to Grant Type: Client Credentials.
It worked for me.
Certainly as mentioned in other comments, for client_credentials it would work but for the Implicit or Authorization Code, I used "https://app.getpostman.com/oauth2/callback" as the callback url and it worked. Also it need to be configured in the application settings in oauth provider.
I've been using this callback url:
https://getpostman.com/oauth2/callbackurl