I'm using passport-github strategy.
passport.use(new Strategy({
clientID: "...",
clientSecret: "...",
callbackURL: 'http://localhost:3000/login/github/return',
scope: 'gist'
},
function(accessToken, refreshToken, profile, cb) {
return cb(null, profile);
}));
Then I make the POST request
app.get('/profile/post',
require('connect-ensure-login').ensureLoggedIn(),
function(req, res){
var url = 'https://api.github.com/gists';
axios.post(url, {
method: "POST",
"description": "POSTING FROM EXPRESS",
"public": true,
"files": {
"file1.txt": {
"content": "EXPRESS "
}
}
})
.then(function (response) {...})
.catch(function (error) { ... });
The gist gets created but anonymously.
I tried passing "owner" and "user" as part of the request arguments but no use. I also tried passing the username in the url
As far as I can see the docs say nothing about this.