Looker API's api/token endpoint fails to retreive an access_token for Authentication

Good Day, developers!

Im having a little bit of trouble accesing the Looker API on my local web server, im running it on http://localhost:3000 and im using javascript (React to be more precise, with Node.js v18.10.0) and im following the steps on the official Google's documentation. 

In that page, the first step is to register an OAuth Id for my application, which i have done, through google cloud's console in this url for OAuth Credentials. Once I do that, the next step is to generate a code_verifier, and save it in the sessionStorage, and then call their https://mycompany.looker.com/auth api, i get a code, and after that, i have to make another call to another service called https://mycompany.looker.com/api/token using that very same code_verifier to receive finally, an access token to make my API Calls through CORS.

In that regard, all i get when I'm trying to use the /api/token service, is a CORS Problem both in my local server, an in my web server on an https website.

maximilianopan_0-1709335909055.png

and when trying to access through Postman i get the next error message:

maximilianopan_1-1709335944553.png

So, in a kind of desperate manner, I need a little assistance, trying to make the Looker API Authentication work for me, either through localhost (for fast testing) or by uploading it to my web server. All I'm getting are CORS errors.

A little bit of extra info:
- Already Registered OAuth App
- Already added my user to the activated_users of the OAuth App registration
- Copied and Pasted the code from the Google Documentation page, auth works, api/token not.
- I want to use the API for a frontend application, only to call for information on a data set.

 

Thank you all in advance and hopefully, you can help me find a solution!

0 1 297
1 REPLY 1

I have the same problem. So suspect the code verifier generation is incorrect. I tried using another verifier code generation, challenge generation (see https://github.com/curityio/pkce-javascript-example), it worked for me (able to get access token).

 

I have to say, this the official Google's documentation.  is poorly managed. The code for base64.js is 13 years ago!