0
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
This way:
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);
}
);
}
I’m creating this angular authentication, I found nothing researching: https://developer.github.com/v3/guides/basics-of-authentication/
You tried for Postman?
– renanvm
No Postman works
– Victor Pereira
I think the requisition might be different
– renanvm
changed the request to the Postman format, and still gives the same error.
– Victor Pereira
give a look at this here https://gist.github.com/jesperorb/6ca596217c8dfba2374966c2b5ab1e. Da uma pesquisada em Cors
– Eduardo Vargas
Shows error details to get a better idea.
– Albert Bitencourt