I am facing an issue to login into the Jenkins using Sharepoint client webpart.
Security on Jenkins Side : using the Azure AD plugin, user can now login using the Office 365 credentials.
On the cloud: Created an App Registration with the redirect URI as - https://{JenkinsDomain}/securityRealm/finishLogin
Now I am creating a client WebPart, and I am trying to access the URL - https:///api/json?tree=jobs[name,color] from the web part, it says 'Error 403 - Forbidden', although when I try the same URL from new tab, it gives me response.
Things I've tried:
const msalConfig = {
auth: {
clientId: "api://<client>/",
// authority: "https://login.microsoftonline.com/common",
authority : "https://login.microsoftonline.com/<tenantID>/",
scopes: ['https://graph.windows.net/Directory.Read.All'],
redirectUri : 'https://<tenantName>.sharepoint.com/'
}
};
var userAgentApplication = new Msal.UserAgentApplication(msalConfig)
userAgentApplication.loginPopup().then(function (id_token) {
console.log(id_token);
var user = userAgentApplication.getAccount();
console.log(user);
if (user) {
}
})
This code gives me error :
AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application: 'api://{clientID}/'.
Is there any way that I can access Jenkins API with Azure AD enabled through the Client Web Part? Any help is appreciated. Thanks
https://{JenkinsDomain}/securityRealm/finishLogin
but in the code you are usinghttps://<tenantName>.sharepoint.com/
which is why you get the STS error – Saravanan