Skip to content

Scope field is not working #29

@gocerk

Description

@gocerk

I'm giving the scope field to the passport.authenticate() but it doesn't redirect me to the Instagram auth URL with query scope parameters.

Here is my code

Router.get('/instagram/callback', (req, res) => {
    passport.authenticate('instagram', {
        scope: ['user_profile', 'user_media'],
        successRedirect: '/profile', 
        failureRedirect: '/login',  
        session: true
    });

    res.json({'status': 'success'});
});

It redirects the user to the https://www.instagram.com/oauth/authorize/?response_type=code&redirect_uri=https://localhost:3000/auth&client_id=my_client_id
As you can see there is no scope query parameter. And unfortunately, Instagram gives an error like this;

{
"error_type": "OAuthException",
"code": 400,
"error_message": "Invalid scope: []"
}

How can I add scope?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions