Failed to generate API key for Dglobal ID via web admin panel - api

I am trying to generate an api key in Dglobal ID to be able to connect to my account to allow my users to register with Dglobal ID. A page should appear where you can request the api key in order to make the POST request.
Generate an api token to authenticate my users with Dglobal ID making a post request. The page appears blank with an error code that says the request could not be processed.

To generate an api key with Dglobal you have to visit id.dglobal.dev login with your account or create a new one and visit your developer page there you have to go to "Developer options" and generate your api key.
I hope that solved your question.

Related

Facebook graph api get the user's infomation

I want to make a website which users can see their posted pictures on the page.
I have signed up for facebook API and have an app id and app secret.
https://graph.facebook.com/oauth/access_token?client_id={#}&client_secret={#}&grant_type=client_credentials
I send users to the oauth to get the user's access token but I don't know what to do next.
https://graph.facebook.com/v3.0/me?fields=id,name,posts&access_token={#}
I thought this would work but I had the error below
"An active access token must be used to query information about the current user.",
The URL you are using to get the Access Token is actually an App Token API.
To generate the Access Token Please replace
https://graph.facebook.com/oauth/access_token?client_id={#}&client_secret={#}&grant_type=client_credentials
with
https://www.facebook.com/v3.0/dialog/oauth?response_type=token&client_id={#id}&redirect_uri={#}&scope=publish_pages
add a redirection url here where the token is published.
OR
better option is to use the login button mentioned here.
https://developers.facebook.com/docs/facebook-login/web/login-button
Also you can read here about all Access Tokens
https://developers.facebook.com/docs/facebook-login/access-tokens/

How to authenticate user with just a Google account on Actions on Google?

Currently Google Assitant includes an easy way to request non-identifiable information about the user and a detailed flow to authenticate the user on a third party service through OAuth2. What about if all I need is have the user authenticate on Google itself? I tried filling in the account linking flow using Google OAuth2 information, but that seems not to work. If that last thing is supposed to work fluently than that would be enough of an answer.
Context: Users already authenticate only with Google on a related webpage. All I need is to link this already authenticated account with the less-authenticated account on Google Assistant.
Update, 25 Oct 2018:
As of 13 September 2018, there is now a much simpler way to access the user's account if your project uses Google Sign-In. Google Sign-In for Assistant will give you an ID Token with information about the user, including their Google ID, with their permission. This permission can be granted just using voice and is fairly streamlined.
You can combine this with a web- or app-based Google Sign-In to get their permission to access OAuth scopes if you need to access Google's APIs.
Update, 25 Oct 2017:
As of around 4 Oct or 7 Oct, Google has updated their policy (again) to restore language restricting OAuth endpoints that are valid. The terms now include
When implementing account linking using OAuth, you must own your OAuth endpoint
and it appears (from the comments below) that they now check for the Google endpoints to prevent this method from working.
At this point, the only thing you can do is setup your own OAuth2 server.
Original Post:
Broadly speaking, the auth tasks you need to do are in four parts:
Configure your project (in the cloud console) so that the Calendar API is enabled and that the OAuth2 client is correctly configured.
Configure the Action for account linking in the action console.
Configure the Actions on Google Integration for your API.AI Agent to indicate that sign-in is required.
When API.AI calls your webhook to fulfill an Intent, it will include an auth token as part of the JSON. You can use this token to make calls to the Google APIs you need.
Configure Cloud Project
You need to configure your cloud project so that it has access to the Google APIs you need and setup the OAuth2 Client ID, Secret, and Redirect URI.
Go to https://console.cloud.google.com/apis/dashboard and make sure you have the project you're working with selected. Then make sure you have the APIs you need enabled.
Select the "Credentials" menu on the left. You should see something like this:
Select "Create credentials" and then "OAuth client ID"
Select that this is for a "Web application" (it is... kinda...)
Enter a name. In the screen shot below, I used "Action client" so I remember that this is actually for Actions on Google.
In the "Authorized Redirect URIs" section, you need to include a URI of the form https://oauth-redirect.googleusercontent.com/r/your-project-id replacing the "your-project-id" part with... your project ID in the Cloud Console. At this point, the screen should look something like this:
Click the "Create" button and you'll get a screen with your Client ID and Secret. You can get a copy of these now, but you can also get them later.
Click on "Ok" and you'll be taken back to the "Credentials" screen with the new Client ID added. You can click the pencil icon if you ever need to get the ID and Secret again (or reset the secret if it has been compromised).
Configure the Action Console
Once we have OAuth setup for the project, we need to tell Actions that this is what we'll be using to authenticate and authorize the user.
Go to https://console.actions.google.com/ and select the project you'll be working with.
In the Overview, make your way through any configuration necessary until you can get to Step 4, "Account Linking". This may require you to set names and icons - you can go back later if needed to correct these.
Select the Grant Type of "Authorization Code" and click Next.
In the Client Information section, enter the Client ID and Client Secret from when you created the credentials in the Cloud Console. (If you forget, go to the Cloud Console API Credentials section and click on the pencil.)
For the Authorization URL, enter https://accounts.google.com/o/oauth2/v2/auth
For the Token URL, enter https://www.googleapis.com/oauth2/v4/token
Click Next
You now configure your client for the scopes that you're requesting. Unlike most other places you enter scopes - you need to have one per line. Then click Next.
You need to enter testing instructions. Before you submit your Action, these instructions should contain a test account and password that the review team can use to evaluate it. But you can just put something there while you're testing and then hit the Save button.
Configure API.AI
Over in API.AI, you need to indicate that the user needs to sign-in to use the Action.
Go to https://console.api.ai/ and select the project you're working with.
Select "Integrations" and then "Actions on Google". Turn it on if you haven't already.
Click the "Sign in required for welcome intent" checkbox.
Handle things in your webhook
After all that setup, handling things in your webhook is fairly straightforward! You can get an OAuth Access Token in one of two ways:
If you're using the JavaScript library, calling app.getUser().authToken
If you're looking at the JSON body, it is in originalRequest.data.user.accessToken
You'll use this Access Token to make calls against Google's API endpoints using methods defined elsewhere.
You don't need a Refresh Token - the Assistant should hand you a valid Access Token unless the user has revoked access.
After contacting Google the current situation seems to be that you should set up your own OAuth2 server, and then on the login screen of your OAuth2 server you should start the Google OAuth2 flow.
you have to have your own endpoint with Google Oauth2 - it is correct that you can't use Google Oauth itself as a provider. To use the Google OAuth service, you can use a "sign in with Google" button in your own endpoint instead.
Source: Contacting Google Actions on Google Support
Kind of speechless right now... as this seems to be a huge oversight on Google's part.
I am able to make it work after a long time.
We have to enable the webhook first and we can see how to enable the webhook in the dialog flow fulfillment docs
If we are going to use Google Assistant, then we have to enable the Google Assistant Integration in the integrations first.
Then follow the steps mentioned below for the Account Linking in actions on google:-
Go to google cloud console -> APIsand Services -> Credentials -> OAuth 2.0 client IDs -> Web client -> Note the client ID, client secret from there
-> Download JSON - from json note down the project id, auth_uri, token_uri
-> Authorised Redirect URIs -> White list our app's URL -> in this URL fixed part is https://oauth-redirect.googleusercontent.com/r/ and append the project id in the URL
-> Save the changes
Actions on Google -> Account linking setup
1. Grant type = Authorisation code
2. Client info
1. Fill up client id,client secrtet, auth_uri, token_uri
2. Enter the auth uri as https://www.googleapis.com/auth and token_uri as https://www.googleapis.com/token
3. Save and run
4. It will show an error while running on the google assistant, but dont worry
5. Come back to the account linking section in the assistant settings and enter auth_uri as https://accounts.google.com/o/oauth2/auth
and token_uri as https://accounts.google.com/o/oauth2/token
6. Put the scopes as https://www.googleapis.com/auth/userinfo.profile and https://www.googleapis.com/auth/userinfo.email
and weare good to go.
7. Save the changes.
In the hosting server logs, we can see the access token value and through access token, we can get the details regarding the email address.
Append the access token to this link "https://www.googleapis.com/oauth2/v1/userinfo?access_token=" and we can get the required details in the resulting json page.
accessToken = req.get("originalRequest").get("data").get("user").get("accessToken")
r = requests.get(link)
print("Email Id= " + r.json()["email"])
print("Name= " + r.json()["name"])
You need to implement the Oauth protocol with whatever Google Assistant app you are developing. Let me be a bit more clear:
The user is on the assistant, you need to link him to any data
you have on your App side
The access to the data you have about
your user is protected by an access token
Google then needs to
ask you for this token to have access to this resource
When
google has the token it can send it to the app so it validates every
requests to get the resource.
This is why you need to implement your own oauth server (Honestly it is just two more endpoints in your application): the identity is checked on google's side, but the link between the user and the resource to access can only be known by you.
The process above is valid, you just need to specify your own token endpoint and your own auth endpoint.
Note that if you only want to check that the user is logged in into google and get his email, you just need to implement the streamlined identity flow that does not require the /auth endpoint (Automatically Sign Up Users with Streamlined Identity Flows)
That beeing said I implemented the flow but get the same error :
expected_inputs[0].possible_intents[0]: Transactions/Identity API must be enabled before using.

How can I get my API KEY on the food2fork site after signup?

I have searched all over on the web site but I can't find my API KEY. Please help.
I had the same issue. I wasn't given a key when I signed up through facebook. Then I created a new login ID, signing up with my email address, and -- bingo!
Login in your account and you should see your API Key in:
http://food2fork.com/F2F/user/api#

How users pass API key with their username and password?

I'm following this tutorial and it works like a charm. But many things are harcoded so I need to change them. I have to check in DB if the username and password are correct and so on... But I don't understand how API keys (or service keys) works.
On the tutorial code, the service key is passing through HTTP header, and then the login method checks if it is matching with username and password provided. But if each user has a unique service key, how users can pass it through HTTP header? Users put their usernames and password into form fields and then press the login button
The tutorial says that the service key is provided to the user by email or other methods. But how the user enters it in the HTTP header of the login form? Where this service key is coming from?
The service key is to give access to the API, not individual users. So take twitter for example: twitter users log in with username and password and don't need a service key. But if you wanted to build your own twitter platform where users can log in to your page and see their tweets in your app (like tweetdeck), you'd need to get a service key to use the twitter API, and you'd send this key along with your http requests from your server to twitter every-time a user logs into your page. Service keys are a way of identifying clients (ie applications) using the API, not specific users using the application.

How can pass the hybrid authorization both GDK and Mirror API

I want to make the glassware, it can take picture and upload taken picture to Google Plus with location information, insert a new card into timeline.
For the uploading the picture to Google Plus with native code by the the glassware, it need to use oAuth flow with GDK. So, that means our server should have to get "userToken" parameter by redirected callback URL according to the guideline of the authorization with GDK.
I also have to pass the flow of the authorization with Mirror API for getting the location information, inserting a new card into timeline. It means our server should have to get "code" parameter by redirected callback URL according to the Mirror API guideline.
However, when i submit the glassware on glassware's submit web page, i can just insert 1 Client ID into "Client ID" form.
According to the glassware guide line, the GDK have to insert the Client ID of Service and the Mirror API have to insert the Client ID of Web Application.
What i have to insert the Client ID into the submit web page ??
How can pass the authorization flow both the GDK and Mirror API ??
If you want to use both GDK auth and the Mirror API to insert items in the timeline, this is the steps that need to happen:
Create one single API Project in the APIs Console and enable the Mirror API --> seems that you've already done that.
Create client IDs:
Create a "Client ID for Web Application": this is the one you are going to use when inserting items in the timeline through the Mirror API
Create a "Client ID for Service Account": this is the one you are going to use when calling the GDK authentications APIs.
Give the API Project ID to the review team: this is the set of numbers that is in the URL (e.g https://console.developers.google.com/project/<PROJECT_ID>/...).
Give an auth URL to the review team: this should be a URL that points to your web server so you can retrieve the ?userToken query parameter for GDK authentication.
When the user clicks on "Install" in MyGlass and is redirected to your auth URL:
Retrieve and save the ?userToken query parameter.
Redirect the user to the OAuth 2.0 authorization URL (you could use the ?state query parameter to pass along the ?userToken query parameter for later use).
Once the user has approved the scopes and is redirected to your redirect URL, exchange the authorization code for OAuth 2.0 tokens (eventually retrieving the userToken in the ?state query parameter if you've used it in step #2).
Push whatever tokens you need through the GDK authentication API using the saved userToken.