im trying to do external login with Google using Aspnet.
I created an mvc/webapi project with individual user accounts (vs2013). This will create some files like the 'AccountController' which contains GetExternalLogins action, after calling this action I get (because the google external login is set in the 'Startup' class) an object like this :
{
name: "Google",
state: null,
url: "/api/Account/ExternalLogin?provider=Google&response_type=token&client_id=self&redirect_uri=http%3A%2F%2Flocalhost%3A11166%2F"
}
The problem now : when i do another http request to "/api/Account/ExternalLogin?provider=Google&response_type=token&client_id=self&redirect_uri=http%3A%2F%2Flocalhost%3A11166%2F" I get the following error :
XMLHttpRequest cannot load https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=my_client_id_here. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:11166' is therefore not allowed access
Im i doing something wrong ?
Thanks a lot.
I realized that its a silly question 5 seconds after posting it.
No need to do an http request, a simple redirection to the url works.
Related
Firebase tells me to do this:
So I did
But I'm still getting this error "The provided value for the input parameter 'redirect_uri' is not valid"
I feel like I've followed instructions exactly but it's still not working. I have no idea how to debug this further. Any suggestions?
Here is my frontend code where I call signIn
let provider = new firebase.auth.OAuthProvider("microsoft.com");
provider.addScope("Calendars.Read");
firebase.auth().signInWithPopup(provider).then(handleResponse);
Edit
I changed the url to my custom domain and it seemed to be working but now I'm getting Error getting verification code from microsoft.com response: proof key for code exchange is required for cross-origin
For some reason Firebase decided to change the url where it handled auth. Instead of using the .firebaseapp.com/__/auth/handler url, it is using my actual custom domain. Though I don't really understand why this would happen...?
The Error getting verification code from microsoft.com response: proof key for code exchange is required for cross-origin was happening because I had configured an SPA on Azure instead of a Web platform.
I want to integrate superset into an iframe.
I already added this into config.py
ENABLE_CORS = True
Also in Config.py, I saw this:
HTTP_HEADERS: Dict[str, Any] = {}
So no need to change
I copied admin role to Public role already
In iframe, I just used this url:
http://x.x.x.x:8088/superset/dashboard/world_health/?standalone=true" width=800 height=800
when loading, I saw this:
Request URL: http://x.x.x.x:8088/api/v1/chart/data?form_data=%7B%22slice_id%22%3A1133%7D&dashboard_id=1
Request Method: POST
Status Code: 400 BAD REQUEST
Remote Address: 35.163.155.64:8088
Referrer Policy: strict-origin-when-cross-origin
The strange thing is I saw other API is working fine, such as this:
http://x.x.x.x:8088/api/v1/chart/1133
So any special issue for this API? api/v1/chart/data?form_data
I already copied all the permissions from admin to Public.
using autodesk forge API, I am trying to create a webhook over folder using the following information; unfortunately, I am receiving the following response:
{
"id":"xxxx-xxxx-xxx-xxxxx",
"status":400,
"code":"VALIDATION_ERROR",
"detail":["Payload is not valid for serialization"]
}
URL:
https://developer.api.autodesk.com/webhooks/v1/systems/data/events/dm.folder.added/hooks (for specific folder added event) or: https://developer.api.autodesk.com/webhooks/v1/systems/data/hooks (for all events). Both are returning the same error
Header:
{
"Content-Type":"application/json",
"Authorization":"<MY_TOKEN>",
"x-ads-region":"US"
}
Data:
{
"callbackUrl":"<MY_DOMAIN>:<MY_PORT>/callback",
"scope":{
"folder":"urn:adsk.wipprod:fs.folder:co.xxxxxxxxxxxx-xxxxx"
}
}
Troubleshooting:
I've tried different folders, root and non-root. I can access all the folders i tried using the api
I am sure that my account is US region
I've tried to add hubId and/or projectId, but I received the same error
<MY_DOMAIN>:<MY_PORT>/callback is configured and working fine
Headers and Data are serializing and de-serializing normally using json loads & dumps
Any suggestion/help?
Answering myself :)
I've discovered that my issue is not related to Forge API, it's a general one related to python Requests. The payload (data) of Requests cannot be nested dictionary, only 1 level dictionary is accepted, nested ones will fail. the solution is to stringify the dict (json.dumps) and use that string as request payload.
EDIT: I was able to resolve the original error here when I realized my ROOT URL was set to my IP address rather than my domain. However, I now have a new issue. My client ID is the same as the original post below. This works fine in the local app, but in production, the popup flashes for a second and then the login box displays "Internal Server Error". I can't see any other messages that would explain it.
I am using the service-configuration package to load the settings, as follows:
ServiceConfiguration.configurations.upsert(
{ service: "google" },
{
$set: {
clientId: "************",
loginStyle: "popup",
secret: "***********"
}
}
);
If I add ?close to the end of my Authorized redirect URI, the Google popup comes up with a redirect_uri_mismatch error, showing the URI without ?close. I think there was an issue resolved here but it at least shows me that my project in Google is being recognized.
ORIGINAL POST
I am setting up an OAuth 2.0 client ID for accounts-google in Meteor and am seeing the following error:
400. That’s an error.
Error: invalid_request
Invalid parameter value for redirect_uri: Raw IP addresses not allowed:
http://***.***.***.***/_oauth/google
My Client ID in Google:
Authorized Javascript Origins
http://localhost:3000
http://myApp.com
Authorized redirect URIs
http://localhost:3000/_oauth/google
http://myApp.com/_oauth/google
I understand I must not be properly pointing the domain to the IP address. I have already set up an A record and the site works fine in other regards though, so not sure what step I missed.
I am able to create folder via put API call.
Now I am trying to use User impersonation to create a new folder giving following headers.
headers = { "Authorization" : "<token>", "As-User" : "237490238" }
It is always giving me 403 forbidden as response.
I also tried creating folder this way via POSTMAN giving X-On-Behalf-Of and X-As-User headers. The response is 201 ( created ) but created_by is not the user (with id = '237490238') provided in headers.
Is it possible to have user impersonation in creating files/folders , creating shared links for files/folders via API?
1: Your Authorization header is not formatted properly. The value needs to be prefixed by Bearer:
headers = {
"Authorization" : "Bearer <token>",
"As-User" : "237490238"
}
2: Ensure that the scope of your authorization token includes Manage an enterprise. This is required in order to use the As-User functionality.