Connecting to Snowflake using Postman - snowflake-connector

I am trying to hit a postman request to Snowflake. I have set up a public/private key correctly but it's giving me error.
{
"code": "390100",
"message": "Incorrect username or password was specified."
}
My JSON is -
{
"statement": "select * from emp_basic",
"timeout": 60,
"database": "SF_TUTS",
"schema": "PUBLIC",
"warehouse": "SF_TUTS_WH",
"role": "ACCOUNTADMIN"
}
Where could be the issue? I tried to decode and verify signature of my JWT token. Its all good.

Related

Forbidden: 403 error aws Device Shadow REST API

I use AWS IoT-core Device Shadow REST API I have created an IAM user role and give all access
this is my API key and header and endpoint
URL: {{endpoint-url}}/things/thingName/shadow
Method: GET
Header: header pass with AWS signature
accessKey: "accessKey"
secretKey: "secretKey"
execute-api working fine this is API response
[
{
"id": 1,
"type": "dog",
"price": 249.99
},
{
"id": 2,
"type": "cat",
"price": 124.99
},
{
"id": 3,
"type": "fish",
"price": 0.99
}
]
but my IoT-core Shadow REST API not working
I follow this docs https://docs.aws.amazon.com/iot/latest/developerguide/device-shadow-rest-api.html
attached screenshot: https://i.stack.imgur.com/luBMa.png
I had the same issue, and the solution was to set the Service Name field in Postman AWS Signature settings used to sign the AWS Signature V4 auth header to iotdevicegateway as per the docs here: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/iot-data.html#IoTDataPlane.Client.get_thing_shadow

GCP API key is not valid in postman

I tried to create new dialogflow intent through postman. It is working in API Explorer but I can't able to connect dialogflow with postman. For doing this I have created some credentials,
New API key in GCP project
Oauth credentials in GCP project
Bearer token from google cloud SDK shell
Here I have used same API in postman but can't able to connect. How can I troubleshoot this?
{
"error": {
"code": 400,
"message": "API key not valid. Please pass a valid API key.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "API_KEY_INVALID",
"domain": "googleapis.com",
"metadata": {
"service": "dialogflow.googleapis.com"
}
}
]
}
}

Facebook (Instagram) Graph API not returning instagram_business_account

First of all, let me explain what I have today:
I have a access token with the following permissions: email, public_profile, pages_show_list, pages_read_engagement, instagram_basic, instagram_manage_insights
I have a valid access token
The accounts that I'm trying to access are Business Account or Content Creator account
With that in mind, here's my problem: some users that are connected to my platform simply don't return the instagram_business_account when I'm requesting /me/accounts.
My request is to https://graph.facebook.com/v10.0/me/accounts with the fields id,name,instagram_business_account{id,biography,ig_id,followers_count,follows_count,media_count,name,profile_picture_url,username,website}.
Here's a sample result where both should return the instagram_business_account, because both are connected to Facebook as a Business Account:
{
"data": [
{
"id": "xxxx",
"name": "xxxxx"
},
{
"id": "xxxxx",
"name": "xxxx",
"instagram_business_account": {
"id": "xxxx",
"biography": "xxxx",
"ig_id": 00000,
"followers_count": 0000,
"follows_count": 0000,
"media_count": 0000,
"name": "xxx",
"profile_picture_url": "xxxx",
"username": "xxxx"
}
}
],
"paging": {
"cursors": {
"before": "xxxx",
"after": "xxxx"
}
}
}
Does anybody have any idea what is the problem happening here?
I figured out the problem. This is a Facebook problem, there's nothing we can do. Instagram is connected on Facebook through instagram_business_account. If this value doesn't exist, that means the account is not connected correctly. The user should reconnect the page https://www.facebook.com/{id}/settings/?tab=instagram_management.
The id value is the one from query result. The second alternative is go to Instagram, go to the profile, click on "Edit Profile" and in "Page", just connect to Facebook again.
With that you will be able to get the correct result.

How to get permission list using Keycloak Token

Can't get the User Permission list using Keycloak token. Getting error like keycloak.exceptions.KeycloakAuthorizationConfigError: Keycloak settings not found. Load Authorization Keycloak settings.
Iam using python-keycloak
Keycloak Configuration
keycloak_openid = KeycloakOpenID(server_url=config.server_url,
client_id=config.client_id,
realm_name=config.realm_name,
client_secret_key=config.client_secret_key,
verify=True)
keycloak_openid.load_authorization_config(os.path.join(local_path, 'Dynamic_Client-authz-config.json'))
userinfo = keycloak_openid.get_permissions(token, method_token_info='introspect')
print(userinfo)
Key Cloak Setting File
{
"allowRemoteResourceManagement": false,
"policyEnforcementMode": "PERMISSIVE",
"resources": [
{
"name": "Default Resource",
"type": "urn:Dynamic_Client:resources:default",
"ownerManagedAccess": false,
"attributes": {},
"_id": "2c2a046f-84b2-42a8-a028-c6ae56ad63a1",
"uris": [
"/*"
]
}
],
"policies": [
{
"id": "f570c7e7-8168-4fb8-b05c-4df8be9398d0",
"name": "Default Policy",
"description": "A policy that grants access only for users within this realm",
"type": "js",
"logic": "POSITIVE",
"decisionStrategy": "AFFIRMATIVE",
"config": {
"code": "// by default, grants any permission associated with this policy\n$evaluation.grant();\n"
}
},
{
"id": "836d2453-ad1c-4482-b726-49875a8ba64f",
"name": "Default Permission",
"description": "A permission that applies to the default resource type",
"type": "resource",
"logic": "POSITIVE",
"decisionStrategy": "UNANIMOUS",
"config": {
"defaultResourceType": "urn:Dynamic_Client:resources:default",
"applyPolicies": "[\"Default Policy\"]"
}
}
],
"scopes": []
}
Please find the solution for my issue
so I am assuming you are looking for the roles?
If so use the introspect token , that worked for me
Introspect Token
token_info = keycloak_openid.introspect(token['access_token'])
print(token_info['resource_access']['client-name']['roles'])
I am able to get the permissions using UMA (mentioned here):
# Get UMA-permissions by token
token = keycloak_openid.token("user", "password")
permissions = keycloak_openid.uma_permissions(token['access_token'])
# Get UMA-permissions by token with specific resource and scope requested
token = keycloak_openid.token("user", "password")
permissions = keycloak_openid.uma_permissions(token['access_token'], permissions="Resource#Scope")
# Get auth status for a specific resource and scope by token
token = keycloak_openid.token("user", "password")
auth_status = keycloak_openid.has_uma_access(token['access_token'], "Resource#Scope")

How can we get the phone number with Google OAuth API and facebook API used for social login?

How can we get the phone number with Google OAuth API login.
I am using scopes as
'scope' : 'https://mail.google.com https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/plus.login '
and the request is as
var request = gapi.client.plus.people.get({'userId': 'me'});
Is there any scope we can use to get it.
I am getting response as with no sight of phone number :
{
"kind": "plus#person",
"etag": "\"vPymIyv1bT9LfmoUujkgN2yLMK0\"",
"gender": "male",
"emails": [
{
"value": "XXX#gmail.com",
"type": "account"
}
],
"urls": [
{
"value": "http://picasaweb.google.com/XXX",
"type": "otherProfile",
"label": "Picasa Web Albums"
}
],
"objectType": "person",
"id": "4354354334435465",
"displayName": "XXXXX YYYY",
"name": {
"familyName": "XXX",
"givenName": "YYYYY"
},
"url": "https://plus.google.com/1100335464643327",
"image": {
"url": "https://lh3.googleusercontent.com/-fgsdgfgU9-jU/AAAAAAAAAAI/AAAAAAAADkM/fgffdgdkM/photo.jpg?sz=50",
"isDefault": false
},
"isPlusUser": true,
"language": "en",
"ageRange": {
"min": 21
},
"circledByCount": 59,
"verified": false
}
if you want to get user phone numbers you have to have authorization from the user: see the following info page : https://developers.google.com/admin-sdk/directory/v1/guides/authorizing
ask the user for this scope of authorization :
https://www.googleapis.com/auth/admin.directory.user.readonly
after you have authorization from user run the folowing request :
GET https://www.googleapis.com/admin/directory/v1/users/userKey
the response will be a JSON response formatted as followed:
https://developers.google.com/admin-sdk/directory/v1/reference/users#resource
one of the attributes is phone list.
hope it helps.
You can use google's people API to get the user's phone numbers.
To explore more you can try yourself.
Steps to explore:
Visit this link.
Select https://www.googleapis.com/auth/user.phonenumbers.read permission in People API v1 section
Click on Authorize API
Choose the account to log in
Grant permission
Click Exchange authorization code for tokens
Enter https://people.googleapis.com/v1/people/138262720636785143353?personFields=phoneNumbers,emailAddresses link, make sure you replace the UID
Click on send request to see the response