PowerQuery Error after reopening workbook "Authorization Error: The credentials for the source Web invalid."

TimvMechelen

Board Regular
Joined
Nov 7, 2016
Messages
121
Hi All,

I'd like to get the spotify web api data from the following link thru Excel PowerQuery web connector: Spotify API link

I created a web query with the following code:

Power Query:
let
    Bron = Json.Document(Web.Contents(functionGetNamedRange("SourceURL"), [Headers=[Accept="application/json", #"Content-Type"="application/json", Authorization="Bearer B.PrivateCode[B][I].[/I][/B]q8tw"]])),
    tracks = Bron[tracks],
    items = tracks[items],
    items1 = items{0},
    #"Geconverteerd naar tabel" = Record.ToTable(items1),
    #"Alternatieve rijen zijn verwijderd" = Table.AlternateRows(#"Geconverteerd naar tabel",0,3,14),
    #"Alternatieve rijen zijn verwijderd1" = Table.AlternateRows(#"Alternatieve rijen zijn verwijderd",3,2,9)
in
    #"Alternatieve rijen zijn verwijderd1"

My funcitonGetNamedRange Query code:
Power Query:
let GetNamedRange=(NamedRange) =>
 
let
    name = Excel.CurrentWorkbook(){[Name=NamedRange]}[Content],
    value = name{0}[Column1]
in
    value

in GetNamedRange

When I enter this data thru the PowerQuery web connector, it works perfectly fine. When I close the workbook and re-open it: the Query cannot refresh anymore. I'm getting the following error:
Authorization Error: The credentials for the source Web invalid. Update the credentials through a refresh operation or in the Data Source Settings dialog box to continue. (Source at https://api.spotify.com/v1/search.)
Even when I'm refreshing the Authorization token, it still doens't work.

Does somebody have a solution?

Thank you in advance for your help.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,223,214
Messages
6,170,774
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top