How to send command using httprequest or facebookclient - facebook

enter image description here
I want to send this command using httprequest or facebookclient

Related

drf social-oauth2 access_denied ,Your credentials aren't allowed

I'm trying to use this package https://github.com/RealmTeam/django-rest-framework-social-oauth2
In Google Example
When I try to request an access_token by
curl -X POST -d "grant_type=convert_token&client_id=<django-oauth-generated-client_id>&client_secret=<django-oauth-generated-client_secret>&backend=google-oauth2&token=<google_token>" http://localhost:8000/auth/convert-token
it's saying
{"error":"access_denied","error_description":"Your credentials aren't allowed"}
What should I put in
django-oauth-generated-client_id and django-oauth-generated-client_secret
is that the thing where you create new application or should I put the google's client and secret ids
I try both but still not working.
Also in
token=<google_token>
I try to put the Authorization code or the access_token in this image but still not working
enter image description here
Can someone help thank you

Can not get user profile using discord access token

I am building an application using discord oauth. I used discord-oauth2 node module to get access_token from discord and was able to get user data from /users/#me endpoint.
So the request would look like this
Request URL: https://discord.com/api/v9/users/#me
Request Headers
authorization: `access_token here`
The above request works but if I change the url to https://discord.com/api/v9/users/{user_id}/profile to get user profile, it returns 401: Unauthorized error.

RESTFul Client in Jersey is generating a new shiro (for authentication) session each time

I have a rest api that has a login resource for authentication using shiro.
When calling the login from postMan client for example then trying to perform an action, I monitor the shiro session on rest server side and it's always the same.
In addition I have a java client that uses Jersey for creating HTTP requests, but when running it I noticed that each call has a different shiro session!
Creating the client once when doing login:
Client client = ClientBuilder.newClient();
baseTarget = client.target(baseUrl);
Then in each call I have something like:
Invocation.Builder builder;
builder = baseTarget.path(apiPath + "blabla")
.queryParam("bla", bla)
.
.
.
.request(MediaType.APPLICATION_JSON);
Response response = builder.post(Entity.json(null));
How can I assure having the same session in each call?!
You will need to send include the associated session cookie (by default JSESSIONID).

extracting html content from gitlab url

I'm trying to get the html content from gitlab url.
But I was struck at Gitlab sign-in page and I am getting html content of sign-in page even after providing username and password.
Code:
from bs4 import BeautifulSoup
import requests
username = "username"
password = "password"
url = "HTTP://gitlab.com/saikumar/webhooktslint"
result=requests.get(url, auth=("username", "password")).content /*
gets
content from the site */
soup = BeautifulSoup(result,'lxml')
for link in soup:
print link
Output:
Getting HTML content of sign_in page.
Expected output:
Need to get the HTML content of the URL specified.
I don't see a repo webhooktslint in your gitlab.com/saikumar page, so it is likely to be a private repository.
Looking at python GitLab CLI usage, make sure to properly set your ~/.python-gitlab.cfg user configuration file, with a GitLab private token in it: you won't have to deal with credentials then.
The gitlab python command will do the curl for you, including to get the raw data of a file.
But that same private token can help authenticate you when trying to do a GET of a private repo as you do in your code (if you are after the actual HTML page content).
Main point, to access a private repo, use a PAT (Personal Access Token) rather than your actual account password.

Is it Possible to trigger request when request received by MockService (Onrequest Script)

I'm trying to automatically trigger a REST request with a groovy script "OnRequest Script"
when my mockservice receives a request.
From "OnRequest Script" I have access to "log, context, mockRequest and mockRunner" variables.
How can I run a testStep or a TestCase from my mockService? Is it possible?
Can I create a new REST request in my mockService and send it?
You can create REST request using HTTPBuilder in groovy script.
Examples: get request, post request
Or you can use RESTClient - it is an extension of HTTPBuilder