I'm trying to create a post like this, more in angular 7:
get '/callback' do
# get temporary GitHub code...
session_code = request.env['rack.request.query_hash']['code']
# ... and POST it back to GitHub
result = RestClient.post('https://github.com/login/oauth/access_token',
{:client_id => CLIENT_ID,
:client_secret => CLIENT_SECRET,
:code => session_code},
:accept => :json)
# extract the token and granted scopes
access_token = JSON.parse(result)['access_token']
end
It looks like this:
getClient(session_code: any) {
this.http.post("https://github.com/login/oauth/access_token", {
"client_id": this.CLIENT_ID,
"client_secret": this.CLIENT_SECRET,
"code": session_code
}, httpOptions).subscribe(
data => {
console.log("POST Request is successful ", data);
},
error => {
console.log("Error", error);
}
);
}
Iamcreatingthisauthenticationinangular,Ididnotfindanythingsearching: link