# Problem using node-red-contrib-graph-oauth-login

**URL:** https://discourse.nodered.org/t/problem-using-node-red-contrib-graph-oauth-login/93510
**Category:** General
**Created:** [27 November 2024 11:20 UTC](https://discourse.nodered.org/t/problem-using-node-red-contrib-graph-oauth-login/93510 "2024-11-27T11:20:15Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![egrootoonk](https://avatars.discourse-cdn.com/v4/letter/e/87869e/32.png) [@egrootoonk](https://discourse.nodered.org/u/egrootoonk)
#### Post date: [27 November 2024 11:20 UTC](https://discourse.nodered.org/t/problem-using-node-red-contrib-graph-oauth-login/93510/1 "2024-11-27T11:20:15Z")

</div>

I'm struggling to access the MS Graph API using the node-red-contrib-graph-oauth-login.

Flow: Inject | node-red-contrib-graph-oauth-login | http request | Debug

I've setup the Azure part and it's working. If I grab the Access token from [Graph Explorer | Try Microsoft Graph APIs - Microsoft Graph](https://developer.microsoft.com/en-us/graph/graph-explorer) and past the token in the authorisation as "bearer" auth. Than I can access the data in the node-red function and ultimately store it in MSSQL.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/0/6089b690cd94f9fffab39a9b894f4c88380b304e.png)

The problem is that after a few hours the token expires.

the node node-red-contrib-graph-oauth-login is also set up correctly. It returns the payload "Application access token still valid, no further action will be taken" and it includes the topics: at:, rt: and bearer: as it should.

But if I use {{msg.payload.bearer}} in the node "http request" and add a Authentication header and {{msg.payload.bearer}}

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/b/fb893c8bae7e0ff11cb72e83d49426a7b3352c6e.png)

I get an error:

payload: "{"error":{"code":"InvalidAuthenticationToken","message":"IDX14102: Unable to decode the header '[PII of type 'Microsoft.IdentityModel.Logging.SecurityArtifact' is hidden. For more details, see [Microsoft Bing Search](https://aka.ms/IdentityModel/PII.)]' as Base64Url encoded string.","innerError":{"date":"2024-11-27T11:19:19","request-id":"4f1af0cf-4952-429d-88f0-d5b95db5c7d0","client-request-id":"4f1af0cf-4952-429d-88f0-d5b95db5c7d0"}}}"

who can help me.

Edwin

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [28 November 2024 06:28 UTC](https://discourse.nodered.org/t/problem-using-node-red-contrib-graph-oauth-login/93510/2 "2024-11-28T06:28:26Z")

</div>

In the headers you are creating a string. Select `Authorization` and set it to `msg.` instead:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/b/1b4d2cba9e9e04afec21411b137b2de9752b86b4.png)

---

<div class="post-metadata">

### Author: ![egrootoonk](https://avatars.discourse-cdn.com/v4/letter/e/87869e/32.png) [@egrootoonk](https://discourse.nodered.org/u/egrootoonk)
#### Post date: [28 November 2024 08:35 UTC](https://discourse.nodered.org/t/problem-using-node-red-contrib-graph-oauth-login/93510/3 "2024-11-28T08:35:37Z")

</div>

Thx for the reply,  
You don't know how many hours I spend to.....

Thanx for the tip. It's working 🙂

Edwin

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [28 November 2024 08:42 UTC](https://discourse.nodered.org/t/problem-using-node-red-contrib-graph-oauth-login/93510/4 "2024-11-28T08:42:50Z")

</div>

If it works for you could you make my post as the solution ? so that the topic will be closed with a solution.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [12 December 2024 08:43 UTC](https://discourse.nodered.org/t/problem-using-node-red-contrib-graph-oauth-login/93510/5 "2024-12-12T08:43:15Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
