-
-
Notifications
You must be signed in to change notification settings - Fork 184
Closed
Description
I am trying to implement a simple non-interactive login to Azure using a client_id and client_secret passed from the users of my CLI tool.
This is my function authentication body:
let token_url: String = format!(
"https://login.microsoftonline.com/{}/oauth2/token",
conf.tenant_id
);
let client_secret: Option<ClientSecret> = match &conf.client_secret {
Some(secret) => Some(ClientSecret::new(secret.clone())),
_ => None,
};
let client =
BasicClient::new(
ClientId::new(conf.client_id.clone()),
client_secret,
AuthUrl::new("http://authorize/".to_string()).map_err(|err| {
error::login(
Some(err),
"could not parse authorization url. it is likely invalid",
)
})?,
Some(TokenUrl::new(token_url).map_err(|err| {
error::login(Some(err), "could not parse token url. it is likely invalid")
})?),
);
let token_result = client
.exchange_client_credentials()
.add_scopes(conf.scopes.clone())
.request(http_client)
.map_err(|err| {
error::login(
Some(err),
"failed to authenticate. could not obtain valid access and refresh tokens",
)
})?;Sorry, I am new to rust, so this is likely user-error. Could someone point out why I am getting the following:
Error: authentication error.: failed to authenticate. could not obtain valid access and refresh tokens
Caused by:
0: Failed to parse server response
1: expires_in: invalid type: string "3599", expected u64 at line 1 column 42
2: invalid type: string "3599", expected u64 at line 1 column 42
Metadata
Metadata
Assignees
Labels
No labels