Code Monkey home page Code Monkey logo

react-adal's Introduction

react-adal

Azure Active Directory Library (ADAL) support for React

react-adal

Azure Active Directory Library (ADAL) support for ReactJS

npm install react-adal

index.js

import { runWithAdal } from 'react-adal';
import { authContext } from './adalConfig';

const DO_NOT_LOGIN = false;

runWithAdal(authContext, () => {

  // eslint-disable-next-line
  require('./indexApp.js');

},DO_NOT_LOGIN);

This index wrap is needed because ADAL use iframes for token silent refresh, and we do not want to have duplicated ReactApp started on iframes too!

indexApp.js (your real app index as it already is - example below)

import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { store } from './store';
import App from './App';

  ReactDOM.render(
    <Provider store={store}>
      <App />
    </Provider>,
    document.getElementById('root'),
  );

adalConfig.js

import { AuthenticationContext, adalFetch, withAdalLogin } from 'react-adal';

export const adalConfig = {
  tenant: '14d71d65-f596-4eae-be30-27f079bf8d4b',
  clientId: '14d71d65-f596-4eae-be30-27f079bf8d4b',
  endpoints: {
    api: '14d71d65-f596-4eae-be30-27f079bf8d4b',
  },
  cacheLocation: 'localStorage',
};

export const authContext = new AuthenticationContext(adalConfig);

export const adalApiFetch = (fetch, url, options) =>
  adalFetch(authContext, adalConfig.endpoints.api, fetch, url, options);

export const withAdalLoginApi = withAdalLogin(authContext, adalConfig.endpoints.api);

use adalApiFetch with your favorite "fetch" in your api call.

withAdalLoginApi HOC

change DO_NOT_LOGIN to true on index.js to stop login on index.js

import MyPage from './myPageComponent';
import Loading from './Loading';
import ErrorPage from './ErrorPage';

const MyProtectedPage = withAdalLoginApi(MyPage, () => <Loading />, (error) => <ErrorPage error={error}/>);

<Route 
   path="/onlyLoggedUsers"
   render={ ()=> <MyProtectedPage /> } 
/>

Logging Out

The AuthenticationContext object (authContext) has a built in function (logOut) to log out of a session. This function redirects user to the logout endpoint. After logout, the user will be redirected to the postLogoutRedirectUri if it was added as a property on the config object. The following code shows an example of how to create a Log Out dropdown in a NavBar

import React from 'react';
import { Navbar, Dropdown, DropdownMenu, DropdownItem } from 'reactstrap';
import { authContext } from '../adalConfig';

...

  render() {
    return (
      <header>
        <NavBar>
          ...
            <Dropdown>
              <DropdownMenu>
                <DropdownItem onClick={() => authContext.logOut()}>
                  Logout
                </DropdownItem>
              </DropdownMenu>
            </Dropdown>
          ...
        </NavBar>
      </header>
    );
  }

changelog

view -> CHANGELOG.md

tutorials from the web

https://itnext.io/a-memo-on-how-to-implement-azure-ad-authentication-using-react-and-net-core-2-0-3fe9bfdf9f36

https://medium.com/@dmitrii.korolev1/react-adal-typescript-pnp-sp-93ef69eddd18

inspired by

https://blog.mastykarz.nl/building-office-365-web-applications-react/

https://medium.com/@adpreg/react-with-redux-app-with-azure-ad-auth-and-net-core-starter-project-88b1bbdb7856

https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-protocols-implicit

MS adal.js

https://github.com/AzureAD/azure-activedirectory-library-for-js

credits

That's all. Enjoy!

react-adal's People

Contributors

dependabot[bot] avatar dkorolev1 avatar itsrainingmani avatar krishardy avatar mackankowski avatar onemanwebdev avatar pspfolio avatar roelvb avatar rokory avatar salvoravida avatar woodl3y avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

react-adal's Issues

Why are we restricting when to allow redirects?

I ran into an issue where the login flow needed to redirect to allow our app to access another API, this library prevented this redirect from happening and just errored out. Why not always allow the redirect to happen if the token is not successfully acquired? Is there any reason we check for specific status codes?
redacted

API GUID Endpoint

First, great work on this, super simple and straight forward! Thanks!

Dumb question, first time really using Azure, so I'm still learning it's ins and outs.

Is an API's endpoint GUID the same as it's TenantId, once it's been setup in AD as a registered app?

Thanks in advance!

How to handle "interaction_required" error when bootstrapping application with "runWithAdal"

I bootstrap my application using "runWithAdal" just like in the instructions. I get an "interaction_required" error after modifying the Service Principal in AAD to contain more permissions. I do not get the consent screen after logging in, instead I get redirected to the application, which does not work at all.

Should I catch this error somewhere and do something about it? In the general ADAL instructions in these cases one should trigger interactive login (like you would expect), but I don't even know how to do that with React ADAL because I don't see any hooks I could attach an error handler to while using runWithAdal.

Typescript

Hi,
Do you have any plan to convert your project to typescript or to provide a type definition ?

Sorry, but we’re having trouble signing you in. We received a bad request.

After I input user (hotmail account) information I got this error:

AADSTS50020: We are unable to issue tokens from this api version for a Microsoft account. Please contact the application vendor as they need to use version 2.0 of the protocol to support this.

here is my config file:

import { AuthenticationContext, adalGetToken, adalFetch } from 'react-adal';

export const adalConfig = {
  tenant: 'common',
  clientId: '25fd0c46-6a83-550c-9a3e-c8214bfe0000',
  endpoints: {
    api: '25fd0c46-6a83-550c-9a3e-c8214bfe0000',
  },
  cacheLocation: 'localStorage',
};

export const authContext = new AuthenticationContext(adalConfig);

export const adalApiFetch = (fetch, url, options) =>
  adalFetch(authContext, adalConfig.endpoints.api, fetch, url, options);

Redirect loop if tenant is left to 'common'

While using the library we can easily get it working if you provide the tenant ID or our active directory. However, we are trying to open this up to other organizations and removing the tenant parameter (leaving it as 'common') causes login redirect loops. There doesn't seem to be any errors in the sessionStorage indicating there was a login failure.

This works:

const adal_config = {
    tenant:"my tenant id",
    clientId: "my client id"
}

However this provides the loop:

const adal_config = {
    tenant:"common",
    clientId: "my client id"
}

Am I missing something?

show a home page with login button

i want my homepage/lading page to be some fancy page with login button, on click of this button i want to redirect to azure login page and upon successful login i want to go inside the main dash board.

i am not able to achive it as the callback function is not propery documented.

hwo to achieve this?

Avoid the infinite loop when access_denied

Hi there,

I'm facing the infinite loop issue that are reported on adal repo (for instance #635 & #463), but with React.
Adal repo is providing guidelines on how to avoid it, but these guidelines are tied to AngularJS.

What I'd like to implement: if a User has no access to my app (because he's not allowed to in Azure AD), then I want to show him an Access denied page

Where I am so far

  1. User browse my app to http://myapp/
  2. This triggers the Azure authentication windows
  3. User authenticates
  4. AzureAD understands my User has no rights, so it redirects to http://myapp/#error=access_denied
  5. At this point, react-adal enters this if, so it triggers authContext.login();, which brings me back to step 2.

And there goes the infinite loop.

To put it in other words : I'm never able to reach the <ErrorPage /> of

const MyProtectedPage = withAdalLoginApi(
  MyPage, 
  () => <Loading />, 
  (error) => <ErrorPage error={error}/>
);

Have you already faced this access_denied loop problem ? Am I missing something obvious ?

adalFetch Returns 401 with POST

I'm trying to send a POST request to an API that is hosted in Azure and is authenticated through Azure Active Directory. I'm using React with React-Adal to send my requests. I configured react-adal using the GitHub repo and this tutorial to guide me.

adalConfig.js

import { AuthenticationContext, adalFetch, withAdalLogin, adalGetToken } from 'react-adal';

export const adalConfig = {
    tenant: 'ad5842d4-1111-1111-1111-111111111111',
    clientId: '1f89aa20-1111-1111-1111-111111111111', //ClientID of the ReactClient application
    endpoints: {
        demoApi: 'e7926712-1111-1111-1111-111111111111', //ClientID of the DemoApi
        microsoftGraphApi: 'https://graph.microsoft.com'
    },
    postLogoutRedirectUri: window.location.origin,
    redirectUri: 'https://localhost:44394/',
    cacheLocation: 'sessionStorage'
};

export const authContext = new AuthenticationContext(adalConfig);

export const adalDemoApiFetch = (fetch, url, options) =>
    adalFetch(authContext, adalConfig.endpoints.demoApi, fetch, url, options);

export const adalTokenFetch = () =>
    adalGetToken(authContext, adalConfig.endpoints.demoApi);

export const withAdalLoginApi = withAdalLogin(authContext, adalConfig.endpoints);

When I use the adalDemoApiFetch with a GET request it works fine and returns 200 with the list of schedules.

const url = `https://localhost:44322/api/Schedules/GetAllSchedules`;

        const response = await adalDemoApiFetch(axios.get, url);
        console.log(response);

        const schedules = response.data;

When I use the same adalDemoApiFetch with a POST to add a new schedule to the list it returns a 401.

const url = `https://localhost:44322/api/Schedules/AddSchedule`;

        const azureADID = authContext.getCachedUser();
        const token = authContext.acquireToken("e7926712-1111-1111-1111-111111111111");
        console.log(token);

        const options = {
            beginningDateTime: this.state.begDateTime.toJSON(),
            endindDateTime: this.state.endDateTime.toJSON(),
            userID: this.state.userID,
            azureADID: azureADID.profile.oid
        };

        const response = await adalDemoApiFetch(axios.post, url, options);
        console.log(response);

I also tried copying out the token and using it in Postman to make the call and it still returns 401. When I use the token that is returned from the function below it works just fine.

export const adalTokenFetch = () =>
    adalGetToken(authContext, adalConfig.endpoints.demoApi);

I use axios to call it in the code below and it works just fine.

const url = `https://localhost:44322/api/Schedules/AddSchedule`;

        const azureADID = authContext.getCachedUser();
        const token = await adalTokenFetch();
        console.log(token);

        const options = {
            beginningDateTime: this.state.begDateTime.toJSON(),
            endindDateTime: this.state.endDateTime.toJSON(),
            userID: this.state.userID,
            azureADID: azureADID.profile.oid
        };

        const response = await axios.post(url,
            {
                data: options
            },
            {
                headers: {
                    "Authorization": `Bearer ${token}`
                }
            }
        );

        console.log(response);

What am I doing wrong? Why would it work with a GET request and not with the POST request? Am I missing something?

Access to roles/groups

How can I access roles or groups information ? Lets suppose I modified the manifest correctly to have groups or roles assigned to each user.

How can I access that information from react app to render different menu?

Question

Hello

I see you posted a comment here:
AzureAD/azure-activedirectory-library-for-js#481

I do have a question though, I have a webapp which is 100% UI only, no business logic, and I used your component to login and it works 100% fine.

However in my webapp at some point I will need to call a REST API, the REST API will be hosted in a different url in Azure, so I created another App Registration in Azure.

Can I use your component to authenticate the REST requests also?

If so, can you please guide me in the right direction? Can this be integrated with axios as the other user did in the previous post?

Usage of adalApiFetch

Hello. excuse me for beeing a bit of a beginner. But how do i use adalApiFetch to send my requests?
I for example use Axios to send http requests. An example would be lovely. Thanks.

// how to use the constant below..

export const adalApiFetch = (fetch, url, options) =>
adalFetch(authContext, adalConfig.endpoints.api, fetch, url, options);
use adalApiFetch with your favorite "fetch" in your api call.

Single Component not rendering when using withAdalLoginApi

Hi

I've successfully used react-adal for my whole application before. However, this time around I only want the security context around 1 certain object (an action bar, the actions which are allowed are based on the user's security context). This is my code shortened:

import ActionBar from './ActionBar.jsx';
class Page extends React.Component  {
constructor(props) {
        super(props);
}

render() {      
        const actionBarWithAdal = withAdalLoginApi(ActionBar, () => <div>Loading</div>,(error) => <div>Error</div>);
return <div>{actionBarWithAdal}</div>
    }
}
class ActionBar extends React.Component {
    constructor(props) {
        super(props);

    componentDidMount() {
        console.log("Mounted");

        this.api.getActions(this.actionsCallback,this.apiErrorCallback);
    }
...
render(){
          console.log("Rendering");
          return <div>{this.state.apiActions}</div>;
      }
}

However, the code is never hitting the mount-method of this ActionBar. What am I doing wrong in my 'page'-component?

How to set oauth state value?

In my application, i would have to pass few values in request and get the same value in response, which is usually done using state in Azure AD but when i use react-adal library, state value is not accepted as it is getting updated with GUID through code and it is not consider as configurable option.
So please let me the approach how would i be able to achieve this

How to handle browser refresh issue

Hi there,

I used react-adal in my project. It works well, but I have an issue with the refreshing browser. If user press F5 to refresh or reload the page, it will do re-authentication, and back to home page. How do we avoid this issue?

Thanks,

adal api request sample

It worked perfect for my reactjs authentication, however I also have external custom apis that I need to call from within react, I guess the endpoints array is to list the app registration is from azure portal. Thats easy, done.

However, can you post an example of how to call a custom api?

Regarding: Redirecting to null page after running it in IIS 8.0

Hi,

I greatly appreciate for react-adal package. I added package in my react project and started using package to authenticate users with in the organization. [url]/signin-oidc (url was localhost in dev environment and different for server) worked totally fine in localhost. but when the code was pushed to server that has IIS 8.0. It started giving me error message 'page does not exist'. Then i removed the signin-oidc as redirect URI. It started diverting to null page. and gave errors saying page does not exist. i removed the null at the end and it goes to my home page. I really want this to work in prod environment and don't want to ask users to remove null at the end of url. what should i do to get rid of null page routing. also why signin-oidc not working on IIS 8.0. It totally works fine on my local host.

Token is not refreshing

If I leave my site open but idle for about an hour, I'm not longer able to make service requests and I'm given a 401 error. I have to refresh the page in order to get a "new" (looking at the local storage of dev tools the tokens are actually the same) token and resubmit my request.
To my understanding adal.js refreshes tokens silently in the background so if the cached token has expired it gets another.
I've set up my adalConfig.js using the guide outlined in the readme, with the addtion of a getToken function that a wrapper around the authContext.getCachedToken(). This is the call I'm using to authenticate during my service requests
I've read some stack overflow responses to similar questions which state suggest that it might be a wrapper issue, but since all my wrapper does is directly return whatever is returned from your getCachedToken function, I figured it must be your wrapper around adal.js that's the issue.

For now I'm just alerting the user to the error and telling them to refresh the page, but I'd like to avoid this in future. Is there something I'm doing wrong or is this truly an internal issue.

(Sorry if I didn't present the question correctly or this not the correct space to ask the question. This is my first time submitting an issue).

Crash the app in IE11

Hi,
When I load he page in IE 11, the crashed and in console I got this message:

HTML1300: Navigation occurred.
TypeError: Object doesn't support property or method 'includes'
{
[functions]: ,
proto: { },
description: "Object doesn't support property or method 'includes'",
message: "Object doesn't support property or method 'includes'",
name: "TypeError",
number: -2146827850,
stack: "TypeError: Object doesn't support property or method 'includes'

Expecting window.local === window.parent limits use of this package

Thanks for the wrapper! One issue I've found is the extremely limiting requirement in which you've required under runWithAdal() that window === window.parent. For my use case I am trying to develop a VSTS Extension that lives within a website, so of course my code never passes this clause. Perhaps it might be helpful to expand the package so that users could either specify a regex for the root/context they expect to be working out of, or an alert if they don't pass the window === window.parent clause? Let me know what you think!

Access to claims.

Hi, is there a way to get access to some of the user information claims after authentication?
Eg: I would like to know who is logged in and do a callback to my dB so I display the UI according to their role.

Than you

Ray

Redirecting to /null

I have added this to a react TS project and it works for the most part but sometimes it get's into a redirect loop which switches between localhost:3000/null and localhost:3000#id_token={token} and then eventually lands on localhost:3000/null

Is there any reason this would be happening? Sometimes it causes 404 errors

Usage with single component issue

Hi! Thanks for library!
Can you please provide an example of usage with adal only one component (not the whole application).
I have only one component (on one url) where it is required an authorization with azure.
Thanks!
And thanks one more time for your library!

adal api request sample to multiple end points.

Hi @salvoravida

So my app is authorised within Azure AD however I wish to access the Microsoft Graph API's as well as the PowerBI API's.

Would I need to create 2 separate functions to call them such as this:

export const adalConfig = {
  tenant: 'tenent.onmicrosoft.com',
  clientId: 'ffffffff-fffff-ffff-ffff-fffffffffffffffff',
  endpoints: {
    graphApiUri: "https://graph.microsoft.com",
    api: 'ffffffff-fffff-ffff-ffff-fffffffffffffffff',
    powerbi: 'https://analysis.windows.net/powerbi/api',
    'https://graph.microsoft.com': 'https://graph.microsoft.com'
  },
  cacheLocation: 'localStorage'
};


export const graphApiFetch = (fetch, url, options) =>
  adalFetch(authContext, adalConfig.endpoints.graphApiUri, fetch, url, options);

export const powerbiApiFetch = (fetch, url, options) =>
  adalFetch(authContext, adalConfig.endpoints.powerbi, fetch, url, options);

As with PowerBi, my main task is just to get the bearer token, is there a way to just get the adal token?

Thanks

Is authentication done by the frontend?

Thanks for the library, it's much more convenient for ADFS integration than SAML libraries I've tried. I'm concerned about security, however.

Added a couple console.log statements around runWithAdal logic and noticed that it fires in the frontend. So is it the frontend that verifies user authentication? Wouldn't that be susceptible to user tampering?

Dependencies - adal

Hey, I really like your work, but your script depends on adal, so it would be nice to add adal as dependencies, not to include it directly. Also, it would be cool to add 'logOut' function.

Support MFA

withAdalLoginApi flow fails when account is configured for MFA. Following error message is thrown -
AADSTS50079: The user is required to use multi-factor authentication.

Based on this, to perform MFA, either acquireTokenPopup() or acquireTokenRedirect() must be called as acquireToken() is not an interactive flow.

Refused to display<url> in a frame because it set 'X-Frame-Options' to 'deny'.

Hi have an SPA app built through CRA. My react app which is authenticated through react-adal library, which is amazing, thank you so much, has been receiving this message when I try to load my iframe inside this other app: Refused to display 'https://login.microsoftonline.com/ in a frame because it set 'X-Frame-Options' to 'deny'.

React:16.8.2
react-adal: 0.4.22

index.js:

const DO_NOT_LOGIN = false;

runWithAdal(
    authContext,
    () => {
        ReactDOM.render(<App />, document.getElementById('root'));
    },
    DO_NOT_LOGIN,
);

exports from App.js:
export default withAdalLoginApi(App);

adalConfig file:

import { AuthenticationContext, adalFetch, withAdalLogin, runWithAdal } from 'react-adal';

export const adalConfig = {
    tenant: process.env.REACT_APP_TENANT,
    clientId: process.env.REACT_APP_MSAL_CLIENT_ID,
    endpoints: { api: process.env.REACT_APP_GRAPH_ENDPOINT },
    cacheLocation: process.env.REACT_APP_CACHE_LOCATION,
    redirectUri: process.env.REACT_APP_REDIRECT_URI,
    popUp: true,
    //eslint-disable-next-line
    displayCall: function(urlNavigate) {
        const popupWindow = window.open(urlNavigate, 'login', 'width=483, height=600');
        if (popupWindow && popupWindow.focus) popupWindow.focus();
        const registeredRedirectUri = this.redirectUri;
        var pollTimer = window.setInterval(() => {
            if (!popupWindow || popupWindow.closed || popupWindow.closed === undefined) {
                window.clearInterval(pollTimer);
            }
            try {
                if (popupWindow.document.URL.indexOf(registeredRedirectUri) != -1) {
                    window.clearInterval(pollTimer);
                    window.location.hash = popupWindow.location.hash;
                    authContext.handleWindowCallback();
                    popupWindow.close();
                }
            } catch (e) {}
        }, 20);
    },
};

const DO_NOT_LOGIN = false;
export const authContext = new AuthenticationContext(adalConfig);

/**
 * Takes React.DOM App render and wraps it,
 * to avoid duplicate ReactApps started on iframes
 *
 * @param {*} path
 */
export const withAdal = dom => runWithAdal(authContext, () => dom, DO_NOT_LOGIN);

/**
 * Logs user out
 */
export const logOut = () => authContext.logOut();

/**
 * adalFetch
 *
 * @param {*} fetch
 * @param {*} url
 * @param {*} options
 */
export const adalApiFetch = (fetch, url, options) => adalFetch(authContext, adalConfig.endpoints.api, fetch, url, options);

export const withAdalLoginApi = withAdalLogin(authContext, adalConfig.endpoints.api);

thank you in advance πŸ™ hope you can lend some insight :)

Unexpected token: name (React)

Hi There,

I just updated latest react-adal. After update, when I run deploy, I got error message. Here are details

SyntaxError: Unexpected token: name (React) [./~/react-adal/lib/react-adal.js:10,0]

any suggestion please?

thanks,

Question: using adalApiFetch with an api?

I was wondering if you could elaborate on this part of the readme?

use adalApiFetch with your favorite "fetch" in your api call.

Like with a sample? Specifically with an api behind it would be amazingly helpful

Questions

Hello

  1. Whats the difference between the 2 implementations, its not easy to understand.
  2. Isnt the tenantid and clientid usually different? being client id the app registration id and tenant id the active directory id?

Thanks

Question: multiple APIs with multiple client IDs

Hello

My application needs two completely different tokens, for accessing different APIs, and each of them require a different client ID (I cannot change the permissions such that the client ID is the same).

How could I configure for this situation?

From what I have seen, the ApplicationContext is a singleton so we would only ever allow one global config, even when I create two instances of it with two different configs.

Thank you.

Page within Iframe

I got this to work in a standalone react app but what if the react page is hosted in an iframe on a different site?
Can this work using the same iframe approach?

Thanks!

Cannot recover from an old sid

react-adal cannot recover from Errors re-obtaining sign-in tokens after leaving browser window open a few days.

This will only apply to application that enable sid in their AAD manifest (which is pretty rare).

Example error: Error AADSTS16002: Application requested a user session which does not exist. Trace ID: 057b129f-0717-489f-99fb-05ec121a3800 Correlation ID: cabaed52-02df-4e61-939f-4ba9151cc75e Timestamp: 2018-10-22 16:24:19Z clientRequestId: KustoWebV2;eb742095-98ac-49d4-80b9-08a692d46b29

This should be fixed the same way MFA was fixed - call acquireTokenRedirect for these cases.

How best to handle errors with adalFetch

Trying to use adalFetch, I see that the underlying adalGetToken it calls will reject when it fails to retrieve a token for the pointed-to resource?

Is it simply to authContext.login() on the next line? Trying to do this, I seem to get a no-op (no redirection, prompt etc.) when calling that login method. It would indicate to me that the authContext thinks I'm logged in (cached user?), despite the authContext.acquireToken not getting a token. I consistently receive a login_required error from adal on Chrome (Firefox seems to work, other browsers break with other problems).

What is 'store'?

Hi,

I can't seem to figure out what import { store } from './store'; refers to.

Please help

Stay signed in option not showing

I had a nodejs server serving the client side (React) only to deal with the authentication, but then I took the nodejs out and I started to use this library on the client side instead. The thing is... the "stay signed in" option isn't showing anymore. I set it up on the azure portal to allow it, but it's still not working.

Any recommendations?

That's what I want:
image

How to specify the webApi endpoint

On adalConfig.js how can we specify an endpoint different from 'api'? (e.g. 'http://localhost:5000/api/')

If I do this:

export const adalConfig = {
    tenant: '<tenant>',
    clientId: '<clientid>',
    endpoints: {
        'http://localhost:5000/api/': '<webapi_appid>',
    },
   cacheLocation: 'localStorage',
};

I get this error on adalApiFetch:
Uncaught (in promise) {message: "resource is required", msg: "resource is required"}

adalFetch returns request and not response

Is adalFetch just supposed to return a refreshed token that I then use to send a request or does it actually send the request. While trying to implement it I'm only receiving a promise of the request that is supposed to be sent, not the response. Looking at my network traffic it seems a call to my api is made but I'm getting a 204 response.
I'm using RxJs/ajax as my fetch object.
I've looked at other issues regarding adalFetch and I'm certain that I'm implementing the call. It's after I make the call that I need more clarity on.

Logout/Signout example

Hi, first of all thanks for the library, it's working great. I was wondering if anyone could provide an example on how to perform a sign out ?
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.