Usin OAuth authentication gives error 404
-
Hello,
I am trying to setup OAuth authentication for a nodejs app I am building which needs credential to access my blog via API.
In the docs I read that I should use these 2 endpoints, but I receive a 404 error.
https://public-api.wordpress.com/oauth2/authorize
https://public-api.wordpress.com/oauth2/token
I am using the simple-oauth2 nodejs package which workers well with other OAuth authentication pages, I tested it they don’t give the 404 (page not found) error.
Can someone help me?
Thank you
The blog I need help with is: (visible only to logged in users)
-
I add the code I am using to authenticate:
const config = { client: { id: process.env.WORDPRESS_CLIENT_ID, secret: process.env.WORDPRESS_SECRET, }, auth: { tokenHost: "https://public-api.wordpress.com/oauth2/token" } }; async function run() { console.log("Creating client...") const client = new ClientCredentials(config); const tokenParams:ClientCredentialTokenConfig = { scope: '<scope>', }; try { console.log("Getting token...") const accessToken = await client.getToken(tokenParams); console.log( accessToken ) } catch (error) { console.log('Access Token error', error); } } run();The error returned:
data: { isResponseError: true, headers: { server: 'nginx', date: 'Wed, 27 Nov 2024 16:52:37 GMT', 'content-type': 'application/json', 'content-length': '140', connection: 'close', 'x-ac': '2.mxp _dca BYPASS', 'strict-transport-security': 'max-age=31536000', 'alt-svc': 'h3=":443"; ma=86400' }, res: IncomingMessage { _events: [Object], _readableState: [ReadableState], _maxListeners: undefined, socket: [TLSSocket], httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, rawHeaders: [Array], rawTrailers: [], joinDuplicateHeaders: undefined, aborted: false, upgrade: false, url: '', method: null, statusCode: 404, statusMessage: 'Not Found', client: [TLSSocket], _consuming: false, _dumped: false, req: [ClientRequest], _eventsCount: 2, [Symbol(shapeMode)]: true, [Symbol(kCapture)]: false, [Symbol(kHeaders)]: [Object], [Symbol(kHeadersCount)]: 16, [Symbol(kTrailers)]: null, [Symbol(kTrailersCount)]: 0 }, payload: { error: 'not_found', message: 'The specified path was not found. Please visit https://developer.wordpress.com/docs/ for valid paths.' } }, isBoom: true, isServer: false, output: { statusCode: 404, payload: { statusCode: 404, error: 'Not Found', message: 'Response Error: 404 Not Found' }, headers: {} } }
- The topic ‘Usin OAuth authentication gives error 404’ is closed to new replies.