Skip to content

How to send Raw http for Instagram Authentication? #350

Closed
@roblav96

Description

I'm trying to connect to the Instagram API with axios.

Here's my code:

axios( {
    method: 'POST',
    url: '/oauth/access_token',
    baseURL: 'https://api.instagram.com',
    params: { // both data and params don't work
        'client_id': 'CLIENT_ID',
        'client_secret': 'CLIENT_SECRET',
        'grant_type': 'authorization_code',
        'redirect_uri': 'REDIRECT_URI',
        'code': 'CODE',
    },
} )

I keep getting the response No client_id so it's not reading any of the params.

When I use restify's StringClient

return new Promise( function ( resolve, reject ) {
    client.post( '/oauth/access_token', {
        'client_id': 'CLIENT_ID',
        'client_secret': 'CLIENT_SECRET',
        'grant_type': 'authorization_code',
        'redirect_uri': 'REDIRECT_URI',
        'code': 'CODE',
    }, function ( errr, reqq, ress, dataa ) {
        if ( errr ) {
            reject( errr )
        } else {
            resolve( dataa )
        }
    } )
} )

It works great.

I think it has something to do with application/x-www-form-urlencoded header maybe?

I would like to know how I can get this working with axios. Thank you!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions