Forum Discussion
Custom Data Connector Credential Check Failing - Username/Password generates a token
The REST API I'm querying requires me to login with a username/password and it will return a token, that token then has to be added to the header as x-redlock-auth then the endpoints can be queried.
Without the navigator PowerBI desktop won't allow me past the credtials section, with the navigator it's prompting when trying to load my table.
I've tried adding my own login section:
Prisma = [
TestConnection = (dataSourcePath) => { "Prisma.login" },
Authentication = [
UsernamePassword = [
UsernameLabel = "Prisma API User",
PasswordLabel = "Prisma API Password"
]
],
Label = "Prisma Data Connector"
];
This logs in or returns null:
shared Prisma.login = () =>
let
loginPayload = [
username = Extension.CurrentCredential()[Username],
password = Extension.CurrentCredential()[Password]
],
responseLogin = Web.Contents("https://api3.prismacloud.io", [
RelativePath = "/login",
Headers = [#"Content-Type" = "application/json"],
Content = Json.FromValue(loginPayload),
ManualCredentials = true
]),
token = Json.Document(responseLogin)[token]
in
token;
I also tried spltting out the login path, however the remote API will return an error unless the crecentials are presented in the way above.
My alert function, calls web.contents with:
response = Web.Contents(url, [
RelativePath = path,
Headers = [
#"Content-Type" = "application/json",
#"x-redlock-auth" = token
],
Content = payLoad,
ManualCredentials = true
]),
but the url is the same:
a = GetAllPages("https://api3.prismacloud.io", "/v2/alert", token, Text.ToBinary(alertPayload))
Any ideas what it's upset about?
2 Replies
- AnonymousNot applicable
Any ideas on this one, thanks in advance.
- V-lianl-msftCommunity Support
Hi Anonymous ,
From the description, there is no problem with the query.
Can log in successfully, but cannot return data?
Could it be an error in the data source path?
See if these will help:
https://docs.microsoft.com/en-us/power-query/samples/trippin/4-paths/readme
https://docs.microsoft.com/en-us/power-query/handlingauthentication#data-source-paths
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.